我为windows商店制作了应用程序。在我将操作系统升级到Windows8.1之前,它运行得很好。在尝试FileOpenPicker时出现了一个错误:
元素找不到。(ИсключениеизHRESULT: 0x80070490)
下面是堆栈跟踪:
在Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAsync() 在Crypto.Engine.d__13.MoveNext()
和代码:
FileOpenPicker fop = new FileOpenPicker();
fop.FileTypeFilter.Add(".jpg");//extension);
fop.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
try
{
StorageFile file = await fop.PickSingleFileAsync();
return file;
}
catch(Exception ex) {}我怎么才能修好它?
发布于 2015-04-10 10:59:57
我遇到了同样的问题,并通过将代码放在正确的线程中解决了:
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();
}https://stackoverflow.com/questions/25942038
复制相似问题