Skip to content
Preptima
hardCodingConceptMidSeniorStaff

You await Task.WhenAll over three calls and two of them fail. What does your catch block see?

4 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

One exception. WhenAll's task faults with an AggregateException holding every failure, but await rethrows only the first inner exception, so recovering the rest means keeping the WhenAll task in a variable and reading its Exception property.

Was this answer helpful?

Likely follow-ups

  • Four of five parallel writes succeeded and one failed. What do you do about the four?
  • What is AggregateException.Flatten for, and what produces nesting deep enough to need it?
  • How does WhenAll behave when one task never completes at all, and how would you bound that?
  • Where does an exception go from a task that was started with Task.Run and never awaited?

Related questions

Further reading