I am probably missing a very obvious fact, but I have a hard time understanding the need for AggregatedExceptions.
I know since async/await we don't have to bother with AggregatedExceptions anymore (or at least are confronted with them less frequently). I can relate to that, because I simply start a task and at some time I choose to synchronize the 'calling thread' with the 'task which runs in parallel'
var sometTask = DoSomethingInParallelAsync().ConfigureAwait(false);
...
...
await someTask;
In this scenario, an exception that occurred in DoSomethingInParallelAsync()
will be presented to me when I await that call.
Why is that so different without using await
, but Wait
on the Task
explicitly?
var someTask = DoSomethingInParallelAsync();
...
...
someTask.Wait();
An exception thrown in this example, will always wrap the thrown Exception
in an AggregateException
. I still don't understand why.
What can't I do when using async/await which takes away the need for AggregateException
s?