Handling Exceptions
In single-core scenarios, LINQ queries are executed sequentially. This means that if your code encounters an exception, the exception is at a specific point, and the code can handle it normally. In multicore scenarios multiple exceptions could occur, because more threads are running on multiple processors concurrently. Because of this, PLINQ provides a special way for intercepting and handling exceptions. Such a way is constituted by the AggregateException class that is specific for exceptions within parallelism. Such a class exposes a couple of interesting members, such as Flatten that is a method that turns it into a single exception and InnerExceptions that is a property storing a collection of InnerException objects, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access