Introduction
Recently, after months without using .Net/C#, I was enhancing an existing .Net/C# WPF application leveraging the .Net Task Parallel Library (TPL).
But naively applying the JavaScript Promises patterns I had used in the previous months I was bitten by a strange issue which forced me to use the quite exotic Unwrap
extension method.
This article describes the issue, explains its cause, provides a fix with Unwrap
, and finally provides a more modern version with the C# 5.0 async/await paradigm.