Ok, so I have a simple uwp application where I try to get data from KnownFolders.VideoLibrary , and to speed things up, I use indexing with QueryOptions . Oddly enough, when I first load the page, I get no errors, but when I try to drill another folder and go to the same page again, I get this Com exception
The error is of type System.Runtime.InteropServices.COMException
HRESULT error E_FAIL was returned from a call to a COM component
FillFolders method in my ViewModel **
private async Task FillUpFolders()
{
uint index = 0, stepSize = 5;
var VideoQuery = FileHelper.GetVideoFoldersQuery(MainFolder, 200);
IReadOnlyList<StorageFolder> folders = await VideoQuery.GetFoldersAsync(index, stepSize);
index += 5;
while (folders.Count != 0)
{
var folderTask = VideoQuery.GetFoldersAsync(index, stepSize).AsTask();
foreach (StorageFolder folder in folders)
{
var vv = new Folder
{
MyStorageFolder = folder,
Title = folder.DisplayName,
Thumbnail = new BitmapImage(new Uri("ms-appx:///Assets/FolderIcon.png")),
MyStretch = Windows.UI.Xaml.Media.Stretch.Uniform
};
Source.Add(vv);
}
folders = await folderTask;
index += 5;
}
}
Video Stream Request Method
internal static StorageFolderQueryResult GetVideoFoldersQuery(StorageFolder Folder, uint thumbnailRequestedSize)
{
if (videoFolderOptions is null)
{
videoFolderOptions = new QueryOptions(CommonFolderQuery.DefaultQuery)
{
IndexerOption = IndexerOption.OnlyUseIndexerAndOptimizeForIndexedProperties
};
videoFolderOptions.SetThumbnailPrefetch(ThumbnailMode.VideosView, thumbnailRequestedSize, ThumbnailOptions.UseCurrentScale);
}
return Folder.CreateFolderQueryWithOptions(videoFolderOptions);
}
github, .
https://github.com/touseefbsb/UWPStorageFolderBug
StackTrace
" Windows.Storage.StorageFolder.CreateFolderQueryWithOptions(QueryOptions queryOptions)\r\n Fluent_Video_Player.Helpers.FileHelper.GetVideoFoldersQuery( StorageFolder, UInt32 thumbnailRequestedSize)\r\n Fluent_Video_Player.ViewModels.LibraryViewModel.d__11.MoveNext( )\r\n --- , -\r\n System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess( )\r\n System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification( )\r\n System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n Fluent_Video_Player.ViewModels.LibraryViewModel.d__9.MoveNext()\r\n --- , -\r\n System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess( )\r\n System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification( )\r\n System.Runtime.CompilerServ ices.TaskAwaiter.GetResult()\r\n Fluent_Video_Player.Views.LibraryPage.d__5.MoveNext()"
. ConfigureAwait (false) Fill() LibraryPage.xaml.cs FillUpFolders() FillUpFiles() viewmodel, Marshall,