title: Task.WaitAll and Exceptions
body: <p>I have a problem with exception handling and parallel tasks.</p>
  
  <p>The code shown below starts 2 tasks and waits for them to finish. My problem is, that in case a task throws an exception, the catch handler is never reached.</p>
  
  <pre><code>        List&lt;Task&gt; tasks = new List&lt;Task&gt;();
          try
          {                
              tasks.Add(Task.Factory.StartNew(TaskMethod1));
              tasks.Add(Task.Factory.StartNew(TaskMethod2));
  
              var arr = tasks.ToArray();                
              Task.WaitAll(arr);
          }
          catch (AggregateException e)
          {
              // do something
          }
  </code></pre>
  
  <p>However when I use the following code to wait for the tasks with a timeout, the exception is caught. </p>
  
  <pre><code> while(!Task.WaitAll(arr,100));
  </code></pre>
  
  <p>I seem to be missing something, as the documentation for <code>WaitAll</code> describes my first attempt to be the correct one. Please help me in understanding why it is not working.</p>