title: Try-Catch Async Exceptions
body: <p>This example "fails":</p>
  
  <pre><code>static async void Main(string[] args)
  {
      try
      {
          await TaskEx.Run(() =&gt; { throw new Exception("failure"); });
      }
      catch (Exception)
      {
          throw new Exception("success");
      }
  }
  </code></pre>
  
  <p>That is, the exception with the text "failure" bubbles up.</p>
  
  <p>Then I tried this workaround:</p>
  
  <pre><code>static async void Main(string[] args)
  {
      try
      {
          await SafeRun(() =&gt; { throw new Exception("failure"); });
      }
      catch (Exception)
      {
          throw new Exception("success");
      }
  }
  
  static async Task SafeRun(Action action)
  {
      var ex = default(Exception);
      await TaskEx.Run(() =&gt;
      {
          try
          {
              action();
          }
          catch (Exception _)
          {
              ex = _;
          }
      });
      if (ex != default(Exception))
          throw ex;
  }
  </code></pre>
  
  <p>That didn't help either.</p>
  
  <p>I suppose my Async CTP refresh installation could be hosed.</p>
  
  <p>Should this code work as I expect ("success" bubbles up, not "failure"), or is this not "supposed" to work that way. And if not, how would you work around it?</p>