Introduction
Until now, you learned about the Task Parallel Library, the latest asynchronous programming infrastructure from Microsoft. It allows us to design our program in a modular manner, combining different asynchronous operations together.
Unfortunately, it is still difficult to understand the actual program flow when reading such a program. In a large program, there will be numerous tasks and continuations that depend on each other, continuations that run other continuations, and continuations for exception handling. They are all gathered together in the program code in very different places. Therefore, understanding the sequence of which operation goes first and what happens next becomes a very challenging problem.
Another issue to watch out for is whether the proper synchronization context is propagated to each asynchronous task that could touch user interface controls. It is only permitted to use these controls from the UI thread; otherwise, we would get a multithreaded access exception...