I have a uno app where I can rename a file using uno UWP but the same code does not rename the file when build against the uno WASM platform.
I am getting the list of files in a folder using a StorageFolder object.
StorageFolder SourceFolder = new FolderPicker();
ObservableCollection<StorageFile> SourceFiles = new SourceFiles();
IReadOnlyList<StorageFile> files = await SourceFolder.GetFilesAsync();
foreach(StorageFile sf in files)
{
SourceFiles.Add(sf);
}
SourceFiles are then bound to a ListView
<ListView x:Name="imagelist" ItemsSource="{Binding SourceFiles}".../>
At a later point in the app I have a button to rename selected items in the ListView.
The Code behind looks like this:
int imageNumber = 0;
foreach(var item in imageList.SelectedItems as StorageFile)
{
imageNumber++;
string newname=$"{imageNumber}.jpg";
if (item is StorageFile sf)
{
await sf.RenameAsync(newname);
}
}
This works in UWP but in WASM it appears to hang at the RenameAsync method. The foreach loop never progresses.
I am wondering if the IReadOnlyList is the problem in WASM but not in UWP. Is there something that I can do differently?