~/talk

Correcting Common Async/Await Mistakes in .NET 8

Talkat Copenhagen Developers Festival 2023 · 2023-08-28..09-01· [dotnet, concurrency]
slides:none on file

Explains concrete fixes for async/await on .NET 8 and C#12: shows the compiler turning async methods into classes (adds ~100 bytes each), demonstrates hidden try/catch in the generated state machine, and shows how non-awaited Task.Run hides exceptions. Uses ConfigureAwait(false) to avoid returning to the UI thread, replaces serial calls with IAsyncEnumerable + Task.WhenAny to stream 50 Hacker News stories, prefers ValueTask for hot paths, recommends cancellation tokens and a SafeFireAndForget helper (used by ~1M downloads).

AI-written summary · about

  1. 0:00Async/await in .NET 8
  2. 13:32Fixing async/await mistakes
  3. 22:55Fire-and-forget safely
  4. 26:44Cancellation tokens
  5. 31:02Never use Task.Wait
  6. 37:03Streaming with IAsyncEnumerable
  7. 47:01Optimizing with ValueTask
  8. 53:42Async/await best practices
  9. 59:27Resources & closing
~/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.