Category: TPL

Fixing Patterns for Async MVVM Applications

Download the code here –AsyncCommands If you like this post you might also like an interesting post on Deadlocks while using tasks. This post is a follow up on Stephen Cleary’s excellent post on MSDN here which is a series of articles he wrote to explain how Tasks based patterns can be effectively adopted for GUI/MVVM applications. […]

Read More →

Deadlocks when using Tasks – solved

In my last post Deadlocks when using Tasks I explained how this innocent looking piece of code can cause a GUI app to deadlock and die. I proceeded to explain the reasons behind this behaviour. In this post I aim to discuss one possible solution to this problem and highlight some potential design considerations that you […]

Read More →

Deadlocks when using Tasks

What is wrong with this code? public static class NiksMessedUpCode { private static async Task DelayAsync() { await Task.Delay(1000); } public static void Test() { // Start the delay. var delayTask = DelayAsync(); // Wait for the delay to complete. delayTask.Wait(); } }   The code compiles without errors yet there is something really terrible […]

Read More →