UWP-在Debug x64(而不是x86)下运行时,create_task崩溃了

时间:2019-04-24 07:55:06

标签: visual-studio asynchronous uwp task c++-cx

我有以下异步编程代码正在检索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();
    }
 }

有帮助吗?

0 个答案:

没有答案