July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Handling exceptions is a crucial topic in parallel programming. The problem is that multiple tasks that run concurrently could raise more than one exception concurrently, and you need to understand what the actual problem is. The .NET Framework 4.6 offers the System.AggregateException class that wraps all exceptions that occurred concurrently into one instance. Such class then exposes, over classic properties, an InnerExceptions collection that you can iterate for checking which exceptions occurred. The following code demonstrates how you catch an AggregateException and how you iterate the instance, starting two tasks that attempt to access two files that do not exist:
Dim aTask = Task.Run(Sub() ...