title: Why is only one from many exceptions from child tasks always propagated?
body: <p>I am struggling to better grasp the rationale of exception and error handling in TPL (and with some more luck in .NET 4.5 async/await tasks)   </p>
  
  <p>The slightly modified from my earlier question <a href="https://stackoverflow.com/questions/16571791/how-to-better-understand-the-code-statements-from-async-handling-multiple-exc#16571791">"How to better understand the code/statements from "Async - Handling multiple Exceptions" article?"</a> C# console app code running 2 <s>detached inner nested</s> attached (dependent) child (Update: sorry, started one question but ended by another!) tasks:</p>
  
  <pre><code>class Program
  {  
     static void Main(string[] args)
     {  Tst();
        Console.ReadLine();
     }
     async static Task  Tst()
     {
         try
         {
             await Task.Factory.StartNew
               (() =&gt;
                  {
                     Task.Factory.StartNew
                         (   () =&gt; { 
                                      Console.WriteLine("From 1st child");
                                      throw new NullReferenceException(); 
                                    }
                              , TaskCreationOptions.AttachedToParent
                          );
                 Task.Factory.StartNew
                         (  () =&gt;
                                 { 
                                     Console.WriteLine("From 2nd child");
                                     throw new ArgumentException(); 
                                 }
        ,TaskCreationOptions.AttachedToParent
                         );
                  }
               );
      }
      catch (AggregateException ex)
      {
          Console.WriteLine("** {0} **", ex.GetType().Name);
          foreach (var exc in ex.Flatten().InnerExceptions)
          {
               Console.WriteLine(exc.GetType().Name);
          }
      }
      catch (Exception ex)
      {
         Console.WriteLine("## {0} ##", ex.GetType().Name);
      }
   } 
  </code></pre>
  
  <p>produces output that alternates (non-deterministically) between:  </p>
  
  <pre><code>From 1st child
  From 2nd child
  ** AggregateException **
  ArgumentException
  </code></pre>
  
  <p>and</p>
  
  <pre><code>From 1t child
  From 2nd child
  ** AggregateException **
  NullReferenceException
  </code></pre>
  
  <p>Seems like always one and only one exception from one of a child tasks always propagated/caught.   </p>
  
  <p>Why is only one exception propagated/caught?<br>
  I'd have better understood if none or rather all exceptions from child tasks are always caught  </p>
  
  <p>Is it possible, in this situation, that both or none exception will be caught?  </p>