title: Throw an aggregate exception from a task won't break all other tasks
body: <p>I have two tasks:</p>
  
  <pre><code>try
  {
      List&lt;Task&gt; tasks = new List&lt;Task&gt;();
  
      Task task1 = Task.Factory.StartNew(() =&gt; func(param));
      tasks.Add(task1);
      if (someCondition)
      {
          Task task2 = Task.Factory.StartNew(() =&gt; func2(param2));
          tasks.Add(task2);
       }
  
       tasksArr = tasks.ToArray();
  
       Task.WaitAll(tasksArr);
   }
   catch (AggregateException e)
   {
       //handle
   }
   catch (Exception)
   {
       //handle
   }
  </code></pre>
  
  <p>If an exception occurs in one of the tasks, I'm throwing a new aggregation exception, but 'm reaching the catch statement only after the second task finishes. I want to catch it immediately, in order to stop unnecessary work in the second task.</p>
  
  <p>I tried to use a cancellation token:</p>
  
  <pre><code>CancellationTokenSource cts = new CancellationTokenSource();
  
  Task.WaitAll(tasksArr,cts.Token);
  </code></pre>
  
  <p>But this wasn't a good solution since it requires that the inner exception will be handled + the caught exception will be an <code>OperationCanceledException</code></p>
  
  <p>Any ideas?</p>