I have a question regarding the .NET Task Parallel Library’s error handling. In which cases will an AggregateException hold more than 1 inner exception? I know this can happen for ex. when calling Task.WaitAll(anArrayOfTasks), and 2 or more tasks are throwing an exception, but are there any other cases (i.e., can it be possible that, if only waiting for 1 task to finish, you get more than 1 inner exceptions)?
I have a question regarding the .NET Task Parallel Library’s error handling. In which
Share
A task can raise an aggregate exception which inherently can contain multiple inner exceptions. This means that you should always consider an aggregate exception with multiple inner exceptions when working with tasks. Even if you’re not using Task.WaitAll, the task you’re waiting on might internally wait for multiple subtasks. Alternatively, the task your waiting on might return multiple exceptions. You simply can’t know as a caller.