title: Exception Handling (Task Parallel Library) .Net Framework 4.0 Beta 2
body: <p>at the moment I am trying some of the new Features of the Task Parallel Library,
  shipped with the .Net Framework 4.0 Beta 2.</p>
  
  <p>My question relates specifically to the Exception Handling within the TPL as 
  described here:
  <a href="http://msdn.microsoft.com/en-us/library/dd997415%28VS.100%29.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/dd997415%28VS.100%29.aspx</a></p>
  
  <p>First example (changed it a little bit):</p>
  
  <pre><code>    static void Main(string[] args)
      {
          var task1 = Task.Factory.StartNew(() =&gt;
          {
              throw new Exception("I'm bad, but not too bad!"); // Unhandled Exception here...
          });
  
          try
          {
              task1.Wait(); // Exception is not handled here....
          }
          catch (AggregateException ae)
          {
              foreach (var e in ae.InnerExceptions)
              {
                  Console.WriteLine(e.Message);
              }
  
          }
  
          Console.ReadLine();
      }
  </code></pre>
  
  <p>According to the documentation the Exception should be propagated back 
  to the to the joining thread which calls: <code>task1.Wait()</code>. </p>
  
  <p>But I always get an Unhandled Exception within:</p>
  
  <pre><code>var task1 = Task.Factory.StartNew(() =&gt;
  {
      throw new MyCustomException("I'm bad, but not too bad!");
  });
  </code></pre>
  
  <p>Could someone explain to me why, or does someone know if there something has changed since the release of Beta 2?</p>