Hello,
Welcome to Microsoft Q&A.
It is a permission design, if you want to continue using RenameAsync, you need to add broadFileSystemAccess capability:
After adding the corresponding capability, you need to enable the access permission of the application in
Settings
-> Pivacy
-> File system
After this, the method can be executed normally, which also confirms that this is a permission design.
It is a bit complicated, you also mentioned that you found a workaround, so you can continue to use it.
---
Update
In addition to using broadFileSystemAccess, there is another method, which is to add folders to FutureAccessList, which is also a way to increase application access permissions. After testing, it works.
if (folder != null)
{
StorageApplicationPermissions.FutureAccessList.Add(folder);
var file = await folder.CreateFileAsync("test.txt", CreationCollisionOption.ReplaceExisting);
await file.RenameAsync("My File.txt", NameCollisionOption.ReplaceExisting);
}
Thanks.