Asynchronous Programming From The Ground Up
summary
Demos in WPF and ASP.NET show that async/await compiles into a generated state machine (example decompiles to ~70 lines) that preserves context, so blocking with Task.Result or Task.Wait causes deadlocks; using Task.Run around Parallel.For can still lock the UI. Practical rules: use async void only for event handlers, prefer returning Task instead of unnecessary async/await to avoid extra state machines, use CancellationToken for smart cancels, and remember ConfigureAwait(false) changes context and can break access to thread‑static or HttpContext data.
AI-written summary · about
chapters (9)
- 0:00Start
- 7:16Blocking - Non Blocking Code
- 9:53Task Parallel Library
- 29:49async & await - The Bad
- 31:17State Machine?
- 32:09What does applying async really do?
- 34:52Inside the State Machine
- 37:10How do we fix it?
- 45:56Deadlocks...
related talks
57mBack to Basics: Efficient Async and Await
58mBack to Basics: Efficient Async and Await
01h 00mAvoiding common pitfalls with async/await
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
01h 15mBest Practices for Using async and await
01h 00mCorrecting Common Async/Await Mistakes in .NET
49mCorrecting Common Mistakes in Asynchronous .NET Code
55mAsync internals in .NET
