I made the app for windows store. It worked fine until I upgraded my os to Windows 8.1. There is an error while I'm trying to FileOpenPicker:
Element not found. (Исключение из HRESULT: 0x80070490)
Here is stacktrace:
at Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAsync()
at Crypto.Engine.d__13.MoveNext()
and code:
FileOpenPicker fop = new FileOpenPicker();
fop.FileTypeFilter.Add(".jpg");//extension);
fop.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
try
{
StorageFile file = await fop.PickSingleFileAsync();
return file;
}
catch(Exception ex) {}
How can I fix it?
I encountered the same problem and solved by putting code in the right thread:
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
CoreDispatcherPriority::High,
ref new DispatchedHandler([]()
{
// **ATTANTION**: direct call `PickSingleFileAsync` in render loop will crash
//http://sertacozercan.com/2013/10/fixing-element-not-found-exception-from-hresult-0x80070490-error-in-windows-8-x/
FileOpenPicker^ openPicker = ref new FileOpenPicker();
openPicker->ViewMode = PickerViewMode::Thumbnail;
openPicker->SuggestedStartLocation = PickerLocationId::PicturesLibrary;
openPicker->FileTypeFilter->Append(".png");
openPicker->FileTypeFilter->Append(".jpg");
openPicker->FileTypeFilter->Append(".jpeg");
auto task = openPicker->PickSingleFileAsync();
}
User contributions licensed under CC BY-SA 3.0