I had a problem with the unexpected termination of my application when the modal dialog generated from the main program window closes normally. No unhandled exceptions are thrown, and none of the Closing or Closed events fires in the main application window.
Essentially, I have a main / shell window that runs in the application code using ShellWindow.Show (). Through the menu, the user can generate a custom opening dialog, this is a new window created and then shown using ShowDialog (the owner of the window is set in the window of the shell window).
When the dialog is closed (internally, when _modalDialogWindow.Close () is called), the application closes, while I expected the modal dialog to be closed.
Debugging the code indicates that ShellWindow is being unloaded from memory because the next line of code after _modalDialogWindow.Close () has dropped out of Application.Run () in the static program code.
If anyone has any ideas, Iām ready to try something.
source share