title: Catching an exception thrown in an asynchronous callback
body: <p>I have a method that takes a callback argument to execute asynchronously, but the catch block doesn't seem to be catching any exceptions thrown by the synchronous call (<code>this.Submit</code> refers to a synchronous method).</p>
  
  <pre><code>public void Submit(FileInfo file, AnswerHandler callback)
  {
      SubmitFileDelegate submitDelegate = new SubmitFileDelegate(this.Submit);
      submitDelegate.BeginInvoke(file, (IAsyncResult ar) =&gt;
      {
          string result = submitDelegate.EndInvoke(ar);
          callback(result);
      }, null);
  }
  </code></pre>
  
  <p>Is there a way to catch the exception thrown by the new thread and send it to the original thread? Also, is this the "proper" way to handle async exceptions?  I wrote my code so it could be called like this (assuming the exception issue is fixed):</p>
  
  <pre><code>try
  {
      target.Submit(file, (response) =&gt;
      {
          // do stuff
      });
  }
  catch (Exception ex)
  {
      // catch stuff
  }
  </code></pre>
  
  <p>but is there a more proper or elegant way to do this?</p>