Best Practices for Using async and await
summary
Shows concrete bugs and fixes: an async void breaks code pattern causes uncaught exceptions and race conditions until inner methods return Task and callers await them; calling task.Result produces a reproducible deadlock on the UI thread; adding Task.Delay as a “fix” provokes races; using ConfigureAwait(false) prevents some deadlocks but then requires explicit marshalling back to the UI or synchronization context to access controls. Demonstrations use four .NET Core WPF sample apps and code is on GitHub (damirarh/jbdnd-async-await).
AI-written summary · about
chapters (8)
- 0:00Introduction
- 4:42Synchronous vs. asynchronous
- 13:23async void breaks asynchronous code
- 31:52Deadlocks
- 42:18ConfigureAwait(false)
- 49:50SynchronizationContext
- 55:07Summary
- 59:20Q&A
related talks
58mBack to Basics: Efficient Async and Await
01h 02mBack to Basics: Efficient Async and Await
57mBack to Basics: Efficient Async and Await
59mAsynchronous Programming From The Ground Up
01h 01mBack to Basics: Efficient Async and Await
01h 00mCorrecting Common Async/Await Mistakes in .NET
01h 01mCorrecting Common Async/Await Mistakes in .NET 9
01h 00mCorrecting Common Async/Await Mistakes in .NET 8
