Advertisement
Intermediate .NET MAUI, Concurrency & Threading

What are common async/await pitfalls in MAUI?

Short answer

Avoid async void except for event handlers (it swallows exceptions); don't block with .Result/.Wait() (deadlocks/UI freeze); use ConfigureAwait appropriately in library code; and handle exceptions in fire-and-forget tasks.

Save .NET MAUI mock interview
Advertisement
AModel answer
Avoid async void except for event handlers (it swallows exceptions); don't block with .Result/.Wait() (deadlocks/UI freeze); use ConfigureAwait appropriately in library code; and handle exceptions in fire-and-forget tasks. Prefer async Task and propagate cancellation with CancellationToken.
// Bad: async void hides exceptions
async void Load() { await FetchAsync(); }
// Better: async Task, awaited or safely handled
async Task LoadAsync() { await FetchAsync(); }
Real-world example
A silent failure disappears once a fire-and-forget async void is converted to an awaited async Task with try/catch.
Likely follow-ups
  • When is async void acceptable? | How do you cancel async work?
Related topics