Is there any way to make a program stop and exit the program when it crashes? I am using C# to develop the program and machines it is run on are 32 bit Windows 7 Professional machines.
So, for example, when my X.exe crashes, a little pop-up window with 2 options come up:
1 – Look for solutions online.
2 – Stop X.exe
I want the second option to be automatically selected and my program is stopped. I have another program that monitors X.exe so when X.exe is stopped, it will start a new instance of X.exe.
You can add a global exception handler for unhandled exceptions. This handler is always called when your program did not handle an exception during runtime which will cause the programm to crash:
In Wpf-Applications you can add the handler like this:
The same for WinForms:
And for console applications: