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 uses the AggregateException
class, which is specific for exceptions within parallelism and has already been discussed in this chapter. With PLINQ, you might find useful two members: Flatten
is a method that turns it into a single exception, and InnerExceptions
is a property storing a collection of InnerException
objects. Each represents one of the occurred exceptions.
Disable “Just My ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.