title: C# application exits when I dispose
body: <p>Basically I have a Login window which should close once the user logs in and show another window, for now I've just hid it(Form.Hide()) however I do not wish to take unnescesary system resources and I don't need the login window after I already logged in.</p>
  
  <p>this is the code snippet where I perform the operation:</p>
  
  <pre><code>MainWindow w = new MainWindow();
          TimeRegisterApI.Instance.Windows.Add(w.Text,w);
          TimeRegisterApI.Instance.Windows[w.Text].Show();
          this.Dispose();
  </code></pre>
  
  <p>Windows is a dictionary that stores references of forms with their title as the key.
  TimeRegisterApi is a singleton.
  Basically what happens is that my application exits after I login instead of just disposing the login window, when I want it to dispose(close and go to the garbage collector.)</p>
  
  <p>I know that having the title as key might cause duplicate key entries but in my current design it's no problem.</p>