Async/await makes asynchronous code much easier to write because it hides away a lot of the details. Many of these details are captured in the SynchronizationContext which may change the behavior of your async code entirely depending on the environment where you’re executing your code (e.g. WPF, Winforms, Console, or ASP.NET). By ignoring the influence of the SynchronizationContext you may run into deadlocks and race conditions. The SynchronizationContext controls how and where task...
Part II: Mimic SynchronizationContext behaviour on .NET CF
Not long ago I posted the first part of this article under: Part I: Mimic SynchronizationContext behaviour on .NET CF The article was intended to give the reader a better feeling of the purpose of the SynchronizationContext and the importance of the class on behalf of synchronization between different apartment threads. Unfortunately the SynchronizationContext is not available on the .NET compact framework which is especially annoying when you want to port existing code which uses the...
Part I: Mimic SynchronizationContext behaviour on .NET CF
Before I got into the details of the problem I want to briefly describe what the SynchronizationContext class really does and what it’s main purpose really is in the first part of the article. From that perspective I’m going to show how the basic functionality of the SynchronizationContext class can be implemented for the .NET compact framework in the second part of the article..