title: Custom MessageBox Through Synchronization Context - Cannot Access Disposed Object
body: <p>I am in a fairly odd situation here. I have created a custom MessageBox form (instead of the built-in <code>MessageBox.Show</code>). The below code is what I use to call up the form, when I need it:</p>
  
  <pre><code>    internal DialogResult ShowCustomMessageBox(string message, string caption, Icon icon = null)
      {
          var result = DialogResult.None;
          MainForm.Get.UISynchContext.Send(s =&gt;
          {
              var messageBox = new DialogBox
              {
                  Icon = icon,
                  Text = caption,
                  rtbInDialogBox = { Text = message }
              };
              result = messageBox.ShowDialog();
              messageBox.Dispose();
          }, null);
          return result;
      }
  </code></pre>
  
  <p>When I run this, I get an error message on <code>messageBox.ShowDialog();</code> that the messageBox instance has already been disposed.</p>
  
  <p>When I post the code to the synchronization context I was pretty sure MainForm would run the code itself (as opposed to other threads), and I am not sure why it tells me that the messageBox has already been disposed.</p>
  
  <p>Any ideas?</p>