title: Why does an exception in an async Parallel.ForEach crash the application?
body: <p>Why does the following crash if run inside a console application instead of throwing an <code>AggregateException</code> and being caught by the outer <code>try/catch</code>?</p>
  
  <p>I've simplified the use case for the <code>await</code> for brevity, but in the relevant code I am indeed trying to execute an awaitable <code>Task</code> of importance.</p>
  
  <pre><code>var list = new List&lt;string&gt;() {"Error"};
  
          try
          {
              Parallel.ForEach(list, new ParallelOptions()
              {
                  MaxDegreeOfParallelism = 8
              }, async listEntry =&gt;
              {
                  await Task.Delay(5000);
                  throw new Exception("Exception");
              });
          }
          catch (Exception ex)
          {
              //never hits, the application crashes
          }
  
          Console.ReadLine();
  </code></pre>
  
  <p>I note that the following does not cause the application to fail, and an exception is indeed caught, but I do not understand what's really going on as to what is fundamentally different about the two contexts:</p>
  
  <pre><code>var list = new List&lt;string&gt;() {"Error"};
  
          try
          {
              Parallel.ForEach(list, new ParallelOptions()
              {
                  MaxDegreeOfParallelism = 8
              }, listEntry =&gt;
              {
  
                  throw new Exception("Exception");
              });
          }
          catch (Exception ex)
          {
              //exception is caught, application continues
          }
  
          Console.ReadLine();
  </code></pre>