Itβs good that it will be too late, but I thought that I would send it to everyone who is faced with this problem (for example, I just did it), sorry in advance if this is quite simple, I am pretty new in C #, so this threw me a little.
I had the same problem as OP where in my FormClosing event neither Application.Exit () nor Environment.Exit (0) would complete the debugger.
What I found is to look at the link count above my FormClosing event, it shows "0 links". I just copied and pasted the final event from another forum, so there was no event handler to handle the event that I created / copied.
One easy way to resolve this (in addition to copy and paste code) is to create an event handler:
- First go to the tab "Form1.cs [Design]"
- Go to the "Properties" field
- Click "Events"
- Find "FormClosing" and double click on it
If you had the same problem, you should now see that there is at least 1 link to the event. Now when you close the form, it should also stop the debugger.
source share