我有以下异步编程代码正在检索UWP
应用程序捆绑包中的文件:
Uri ^source = ref new Uri("ms-appx:///head.html");
auto getFileTask = create_task(StorageFile::GetFileFromApplicationUriAsync(source));
当我以Visual Studio 2017
模式在Debug x86
中运行代码时,它可以正常工作。但是,在Debug x64
中运行它会导致应用崩溃,并显示以下错误:
HRESULT:0x80070002 The system cannot find the file specified.
WinRT information: The system cannot find the file specified.
,Visual Studio在文件ppltasks.h
中以以下代码中断:
__declspec(noinline)
~_ExceptionHolder()
{
if (_M_exceptionObserved == 0)
{
// If you are trapped here, it means an exception thrown in task chain didn't get handled.
// Please add task-based continuation to handle all exceptions coming from tasks.
// this->_M_stackTrace keeps the creation callstack of the task generates this exception.
_REPORT_PPLTASK_UNOBSERVED_EXCEPTION();
}
}
有帮助吗?