title: Show and ShowDialog won't work
body: <p>It is not like anything i have seen before.<br>
  When i call (new System.Windows.Forms.Form()).ShowDialog()  a form shows for a millisecond or something and then vanishes.<br>
  I traced the calls and got This:  </p>
  
  <blockquote>
    <p>System.Windows.Forms.Form.Dispose<br>
      System.ComponentModel.Component.Dispose<br>
      System.Windows.Forms.Application.ThreadWindows.Dispose<br>
      System.Windows.Forms.Application.ThreadContext.DisposeThreadWindows<br>
      System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop<br>
      System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner<br>
      System.Windows.Forms.Application.ThreadContext.RunMessageLoop<br>
      System.Windows.Forms.Form.ShowDialog        Esfand.Program.Main C#</p>
  </blockquote>
  
  <p>I have tried anything that comes to mind to fix this.  </p>
  
  <p>Although I have showed a login form before trying to show this form.<br>
  I don't think there is anything special going on the login form(usual boring stuff, connect to server, send credentials, receive data).<br>
  I'm using main thread for forms. I have experience with Messaging and message loops. and i have used threads in the login form.  </p>
  
  <p>EDIT:
  Clarification for what Cody Gray suggested:  </p>
  
  <p>This is what I have in <code>void Main(string[])</code>:  </p>
  
  <pre><code>LoginForm login = new LoginForm ();
  login.ShowDialog ();//works
  if (login.DialogResult == DialogResult.OK)
  {
      MainForm f = new MainForm ();
      f.ShowDialog ();//won't work
  }
  </code></pre>
  
  <p>Creating and Showing the MainForm in a new thread made everything to just start working again.but random errors occur on each form that makes this solution not good enough.  </p>
  
  <p>EDIT 2:<br>
  The FormClosing event doesn't even trig.</p>
  
  <pre><code>System.Windows.Forms.Form A;
  A = new Form();
  A.FormClosing += new FormClosingEventHandler((sender, e) =&gt; { System.Diagnostics.Debugger.Break();/*won't work. tried Breakpoints and other stuff too*/ });
  A.ShowDialog();
  </code></pre>
  
  <p>EDIT 3:
  The HandleDestroyed event stack trace: </p>
  
  <pre><code>&gt;   Esfand.exe!Esfand.Program.Main.AnonymousMethod__1(object sender = {System.Windows.Forms.Form}, System.EventArgs e = {System.EventArgs}) Line 50 + 0x6 bytes C#
      System.Windows.Forms.dll!System.Windows.Forms.Control.OnHandleDestroyed(System.EventArgs e) + 0x9e bytes    
      System.Windows.Forms.dll!System.Windows.Forms.Form.OnHandleDestroyed(System.EventArgs e) + 0x13 bytes   
      System.Windows.Forms.dll!System.Windows.Forms.Control.WmDestroy(ref System.Windows.Forms.Message m) + 0x54 bytes    
      System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x547 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) + 0x6d bytes 
      System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 2, System.IntPtr wparam, System.IntPtr lparam) + 0x15e bytes    
      [Native to Managed Transition]  
      [Managed to Native Transition]  
      System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DestroyHandle() + 0xf7 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Control.DestroyHandle() + 0x3e3 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Control.Dispose(bool disposing) + 0x347 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.Dispose(bool disposing) + 0x19 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Form.Dispose(bool disposing) + 0x26a bytes    
      System.dll!System.ComponentModel.Component.Dispose() + 0x1b bytes   
      System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadWindows.Dispose() + 0xb3 bytes  
      System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.DisposeThreadWindows() + 0x12d bytes    
      System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) + 0x58e bytes    
      System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x593 bytes 
      System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x81 bytes    
      System.Windows.Forms.dll!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window owner) + 0x765 bytes    
      Esfand.exe!Esfand.Program.Main(string[] a = {string[0]}) Line 51 + 0x10 bytes   C#
  </code></pre>