我剛開始使用WinRT的併發模型。我有一個任務需要等待,但調用wait()會拋出一個我無法捕捉的異常。等待任務拋出
儘可能簡單的代碼:
concurrency::task<StorageFile^> getFileTask = concurrency::create_task(Windows::Storage::ApplicationData::Current->LocalFolder->GetFileAsync(fileString));
getFileTask.wait();
它拋出一個例外是:
Microsoft C++ exception: Concurrency::invalid_operation at memory location 0x0402C45C
如何設置這使其作品?
你是從ui線程調用這段代碼嗎? – Denis