I'm trying to access all types of files with a FileOpenPicker and display the picked files in a list with thumbnails.
private void Pick()
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
openPicker.FileTypeFilter.Add("*");
openPicker.PickMultipleFilesAndContinue();
}
This works and opens a view where I can either choose to pick files from "Photos", "One Drive" or "Phone". If I choose "Photos", it opens the familiar image picker where I can select pictures and then call
await storageFile.GetThumbnailAsync(ThumbnailMode.ListView)
for the picked files without problems. If I choose "Phone", it opens a more advanced file explorer. When I choose a file from there (even if I choose one of the same images that work when using "Photos" picker), trying to retrieve the thumbnail throws an exception
System.ArgumentException: Value does not fall within the expected range.
What could be causing this and is there a potential fix?