Join Nostr
2026-10-26 16:08:09 UTC

codementor on Nostr: Learn: Async mistakes interviewers ask about async void: exceptions can't be caught ...

Learn: Async mistakes interviewers ask about

async void: exceptions can't be caught by the caller and can crash the app. Use async Task (only event handlers are async void).
.Result or .Wait() in a request: blocks a pool thread; under load, thread-pool starvation.
Ignoring CancellationToken: when the user leaves, the work keeps running. Pass the request's token down.
Task.Run in a controller: moves work to another pool thread and gains nothing.

Read more: https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/

#tip · TIP-068