Reputation: 40333
I am starting a command line app from a C# application, this command line app is another C# application and from time to time it raises an exception and dies, this is not an issue in general and the code knows how to handle this case.
The issue is that whenever it raises this error that windows debugging window is shown. Is there any way I can disable that from the calling program? Like a ProcessStartInfo
property I can use to prevent it from happening?
I can also change the command line program as well, but I´d rather not do it.
Upvotes: 0
Views: 202
Reputation: 127593
The thing you are seeing is the Just-In-Time Debugger, to make your program excluded from the list of detected programs that will launch the debugger you must put the name of your exe in the following registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList
If you are running a 64 bit version of windows you should also add the exe name to
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList
Create a new REG_DWORD value, name it YourAppName.exe
and set the value to 1
.
See this MSDN article for more detailed instructions.
Upvotes: 1
Reputation: 157048
The error is obviously caused by an unhandled exception.
Assuming it is a command line application, why don't you just put a try ... catch
block wrapping the entire Main
method and handle the exception in the appropriate way, like returning an error code to the console or something else you need/want to do.
Upvotes: 0