When I create and show a form and close (terminate) the application when the form is still open, a stack overflow exception is thrown.
Showing the form:
private static void OpenSettings(Object sender, EventArgs e)
{
ActionLog.Write("Opened Settings");
form_Settings f_Settings = new form_Settings();
f_Settings.Show();
}
Closing my Application by using the context menu callback:
private static void Quit(Object sender, EventArgs e)
{
ActionLog.Write("Exit");
Settings.Serialize();
Environment.Exit(0);
}
the exception is thrown in the GUI.form_Settings.Dispose function. The function never exits and causes an infinite recursion.
If I don't have the window opened when I close my application, everything goes fine.
How is that?
// Edit:
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
Guess that's pretty standard, I couldn't find any other definitions. Also I want to mention that I'm using a custom framework (https://github.com/viperneo/winforms-modernui), could this be a reason for this behavior?
Dispose()method, perhaps you should post that method? The code given is not relevant to the problem.Quitcalled?