title: Why is Method.Invoke generating unhandled exceptions? Unable to catch even with TargetInvocationException
body: <p>I'm trying to use Method.Invoke to call a windows form dialog, have a user perform some selections/interaction and continue execution.  This invoke call is happening in an asynchronous method.</p>
  
  <p>While everything works fine, should an error occur on the windows form, an unhandled exception is thrown, even when trying to catch <em>TargetInvocationException</em> or just <em>Exception</em>.</p>
  
  <p>Both forms are in the same winforms project. I realize where are other ways to perform an async call but this is just to illustrate the issue.</p>
  
  <p>The form dialog is as follows:</p>
  
  <pre><code>public partial class FakeDialog : Form
  {
      public FakeDialog()
      {
          InitializeComponent();
      }
  
      private void btnOK_Click(object sender, EventArgs e)
      {
          throw new Exception("oh noes!");
  
          this.DialogResult = DialogResult.OK;
          this.Close();
      }
  
      private void btnCancel_Click(object sender, EventArgs e)
      {
          this.DialogResult = DialogResult.Cancel;
          this.Close();
      }
  
      public new DialogResult ShowDialog()
      {
          base.ShowDialog();
          return this.DialogResult;
      }
  }
  </code></pre>
  
  <p>And here is the calling code. None if the catch blocks are being executed, even when not debugging (my problem is not debugging exceptions in the IDE as mentioned <a href="https://stackoverflow.com/questions/4117228/c-reflection-methodinfo-invoke-block-exceptions-from-inside-the-method">here</a>. The following results in an unhandled exception).</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
      private void Form1_Load(object sender, EventArgs e)
      {
  
          MethodInvoker simpleDelegate = new MethodInvoker(InvokeForm);
          IAsyncResult tag = simpleDelegate.BeginInvoke(null, null);
          simpleDelegate.EndInvoke(tag);
          MessageBox.Show("All done");
      }
  
      private void InvokeForm()
      {
          try
          {
              Type t = typeof(FakeDialog);
              MethodInfo showDialogMethod = t.GetMethod("ShowDialog", new Type[] { });
              object dialog = Activator.CreateInstance(t);
              System.Windows.Forms.DialogResult result = (System.Windows.Forms.DialogResult)showDialogMethod.Invoke(dialog, new object[] { });
              MessageBox.Show(result.ToString());
  
          }            
          catch (TargetInvocationException tie)
          {
              MessageBox.Show("Tie exception");
          }
          catch (Exception ex)
          {
              MessageBox.Show("general exception");
          }
      }
  }
  </code></pre>
  
  <p><b>UPDATE:</b></p>
  
  <p>Strangely, I'm able to catch the exception when running with debugging (I'm sure the IDE is helping here).  Running without debugging causes the unhandled exception.</p>
  
  <p>Also, invoking via an async call doesnt seem to make a difference.  If i just call <em>InvokeForm()</em> (ignore all the methodInvoker stuff), I can achieve the same result.</p>
  
  <p>Operating on .NET 2.0 using Visual Studio 2008.</p>