title: Exception handling : Thread v/s Task
body: <p>Thread version results in unhandled exception, which crashes the app but the task version doesn't. Both are running exactly the same method Can someone explain the reason for this difference in exception behavior ?</p>
  
  <p>Thread version:</p>
  
  <pre><code>            try
              {
                  new Thread(new ThreadStart(DoWork)).Start();  // do work throws exception
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }
  
          static void DoWork()
          {
              Console.WriteLine("in thread");
              throw new Exception();
          }
  </code></pre>
  
  <p>Task version:</p>
  
  <pre><code>      var errorTask = Task.Factory.StartNew&lt;Func&lt;string&gt;&gt;(() =&gt;
                  {
                      Console.WriteLine("in task");
                      throw new Exception();
                  });
  
              try
              {
                  string result = errorTask.Result();
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }
  </code></pre>