~/talk

Correcting Common Async/Await Mistakes in .NET 9

Talkat NDC Melbourne 2025 · 2025-04-29..05-01· [dotnet, concurrency]
slides:none on file

Shows that the C# compiler turns async methods into state machine structs (about +80 bytes in release) and always wraps MoveNext in a try/catch that can hide exceptions if a Task is not awaited. Demonstrates fixes in a .NET MAUI Hacker News app using sharplab.io, replacing async void with a NuGet safe fire and forget pattern, using Task.WhenEach (new in .NET 9) and IAsyncEnumerable to stream results, ConfigureAwait(false)/ConfigureAwaitOptions, ValueTask and WaitAsync to improve latency, correctness and exception visibility.

AI-written summary · about

  1. 0:00Introduction and resources
  2. 1:03Async/await under the hood
  3. 3:25Compiler-generated state machines
  4. 10:16The danger of unawaited tasks
  5. 12:54Review of async fundamentals
  6. 14:15Fixing common mistakes
  7. 21:06Handling fire-and-forget tasks
  8. 23:04Best practices for async methods
  9. 34:07Advanced performance optimizations
  10. 45:33Summary and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.