This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs.
Last time, we looked at how task cancellation is projected in C++/CX with PPL and co_await with tasks. But PPL also supports awaiting directly on IAsyncAction^ and IAsyncOperation^ objects. Let's try it. Observe that awaiting directly on an IAsyncAction^ and IAsyncOperation^ object throws a different exception from awaiting on a task. You can see this in the await_resume for the IAsyncInfo^ awaiter ind in pplawait.h: The PPL framework checks whether the status of the async operation is Canceled, and if so, it throws E_ABORT, which is represented in C++/CX as OperationCanceledException. So far, all of the cancellation exceptions have generated by the framework. That'll change soon. Next time, we'll look at C++/WinRT.