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
Published at
2026-10-26 16:08:09 UTCEvent JSON
{
"id": "636c6b9b51cf8b48497b721c22a79de87ee74ed7081bb2a803255bfe84deb9b4",
"pubkey": "e68a0856e90d9997b1f721e905249896412dd570399a987b2e8fd5e7fcfe2279",
"created_at": 1793030889,
"kind": 1,
"tags": [
[
"t",
"tip"
]
],
"content": "Learn: Async mistakes interviewers ask about\n\nasync void: exceptions can't be caught by the caller and can crash the app. Use async Task (only event handlers are async void).\n.Result or .Wait() in a request: blocks a pool thread; under load, thread-pool starvation.\nIgnoring CancellationToken: when the user leaves, the work keeps running. Pass the request's token down.\nTask.Run in a controller: moves work to another pool thread and gains nothing.\n\nRead more: https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/\n\n#tip · TIP-068",
"sig": "2f3e9d2bed572edc826694a69e67d7b00c6a1182905523ef980497cc462b4dc1d9e4db5185de88d793a7caa0b0414a7f673d7bbe900ef9de7747198c48b23302"
}