title: Task Parallel Library WaitAll Exception Handling
body: <p>I am working with the Task Parallel Library and I am using the Task Factory to create and start a list of new tasks. After starting the tasks, I make a call to Task.WaitAll(...) to wait until all the Tasks return. The code looks similar to the following.</p>
  
  <pre><code>Tasks&lt;MyClass&gt;[] tasks = .../Create List of Tasks and Start using TaskFactory.StartNew(..) etc.
  
  Task.WaitAll(tasks);         //Wait until all tasks complete before continuing. 
  </code></pre>
  
  <p>When my tasks return and are completed, if they meet certain criteria, the results will be aggregated into a list to be handled at a later time. While each tasks is running, certain exceptions may be thrown which will 'disqualify' the task result from being added to the aggregate list. I want to be able to throw exceptions within the executing task, and the task to no longer run.</p>
  
  <p>I am aware that there are features such as cancellation tokens and cancellation sources for being able to handle certain events, but they don't seem to allow me to do what I want. Althought it doesn't exist, I would have liked functionality such as subscribing to event handlers on the tasks such as task.OnException or task.OnError,etc. What are my options for accomplishing this functionality with TPL?</p>