title: Task<T> and TaskContinuationOptions Clarification in C#?
body: <p>I have this simple code : </p>
  
  <pre><code>var g=  Task.Factory.StartNew&lt;int&gt; (() =&gt; 8)
         .ContinueWith (ant =&gt;{throw null;})
         .ContinueWith (a =&gt;{ Console.WriteLine("OK");},TaskContinuationOptions.NotOnFaulted);
  
   try{
        Console.WriteLine("1");
        g.Wait();
        Console.WriteLine("2");
       }
  
  catch (AggregateException  ex)
        {Console.WriteLine("catch"); }
  </code></pre>
  
  <p>The Output : </p>
  
  <pre><code>1
  catch
  System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
  </code></pre>
  
  <p>msdn   : </p>
  
  <p><em>TaskContinuationOptions.NotOnFaulted</em></p>
  
  <blockquote>
    <p>Specifies that the continuation task should not be scheduled if its
    antecedent threw an unhandled exception. This option is not valid for
    multi-task continuations.</p>
  </blockquote>
  
  <p>ok .</p>
  
  <p><img src="https://i.stack.imgur.com/xkUY1.jpg" alt="enter image description here"></p>
  
  <p>And it is ok  - not showing this line cause the prev line DID throw exception.</p>
  
  <p>Questions : </p>
  
  <ul>
  <li><p>Do I get the <code>AggregateException</code> exception because I haven't inspected the <code>Exception</code> property ? </p></li>
  <li><p>Must I <strong>always</strong> inspect if the antecedent  throw an exception ( in each line ? ) ? ( <em>I can't check each line ! it doesn't make any sense and very annoying</em>)</p></li>
  <li><p>Wasn't the <code>try catch</code> block should have swallow the exception ? ( I thought that all exceptions bubble up to the wait method....so ? )</p></li>
  </ul>