-
Notifications
You must be signed in to change notification settings - Fork 802
Description
Describe the bug
I am porting a UWP app that heavily uses the FileInformationFactory.GetVirtualizedFilesVector() set to a CollectionViewSource and bound to GridView and other UserControls. The app has been working really well for 4 years now, and I decided to port it to WinUI 1.6 given that UWP seems to be being progressively abandonned.
Therefore, I really hope someone could help me on how I can get this code to work on WinUI or advise me to wait otherwise. This app is farily complex so I would like to avoid working on the upgrade if I know that the FileInformationFactory or the CollectionViewSource is not supported (for instance)
I narrowed down the crash to the following. Create a blank WinUI 1.6 App, Setup the code to pick a folder (code not shown but taken from the docs on WinUI. The FolderPicker returns a StorageFolder, named Folder, successfully, and then run the following simple code on the main thread:
var queryOptions = new QueryOptions() { FolderDepth = FolderDepth.Deep };
var query = Folder.CreateFileQueryWithOptions(queryOptions);
var fileInfoVectors =
new FileInformationFactory(query, ThumbnailMode.SingleItem, 192,
ThumbnailOptions.UseCurrentScale, delayLoad: false).GetVirtualizedFilesVector();
var collectionViewSource = new CollectionViewSource()
{
Source = fileInfoVectors
};
In debug mode, Visual Sutio will throw an unhandled Win32 Exception. The reason is Source = fileInfoVectors with the option FolderDepth.Deep.
Question 1
Is this expected for WinUI 1.6 and any plan to have CollectionViewSource and/Or the FileInformatinFactory fully supported?
Question 2
What is the workaround, knowing that I will not use await Folder.GetFilesAsync() or FileInformation.GetFilesAsync(); as they are extremally slow and consume memory.
Thank you for any guidance.
Steps to reproduce the bug
Exectue the code above in a blank app after having picked a folder named here Folder
Expected behavior
Should not throw.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.6.5: 1.6.250205002
Windows version
Windows 11 (24H2): Build 26100
Additional context
No response