I'm working on developing a server process that needs to execute nightly. While working out some kinks, the process occasionally throws an exception. The server in question has Sql Server Management Studio installed on it, which uses Visual Studio as its application shell. This means that the server tries to invoke Just-In-Time debugging whenever an unhandled exception is thrown. This is a problem for a few reasons.
- No one is logged in to the server when the error occurs, so there is no one to actually debug the process
- The attempt to start up JIT prevents the actual exception message from being added to the event log
- The machine isn't (and shouldn't be) set up for debugging the application anyway (it's a DB server, for Pete's sake!)
This MSDN article says to simply start up Visual Studio, go to Tools --> Options --> Debugging --> Just-In-Time and then uncheck all the boxes. This isn't quite enough. To complete the process, I had to follow the steps in another article (Just-In-Time Debugging) and remove some registry keys.
Of course there should not be any unhandled exceptions in an application! However, in the early stages of testing a new server process, it's nice to be able to get helpful error messages when you do experience an unhandled exception.