␡
- Introduction
- To Multithread or Not to Multithread?
- Multithreading with PLINQ
- Handling Concurrent Exceptions
- Processing Items with Parallel.ForEach
- Summary
Like this article? We recommend
Handling Concurrent Exceptions
One of the challenges of using threads is concurrent exceptions—that is, how to handling an exception on one or more additional threads. Parallel LINQ aggregates all exceptions into an instance of System.Threading.AggregateException, marshaled to the calling thread.
The original exceptions are available through the InnerExceptions property, and an AggregateException is created even if only one background thread throws an exception.