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, ...

Get Visual Basic® 2010 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.