Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I keep Vista from killing my program on exceptions?

It used to be that if an exception got raised and propagated far enough up the call stack, Application's main loop would handle it and give you a dialog box. That behavior seems to be broken under Windows Vista. If any exception reaches that level, Vista steps in and says the program "has stopped working," when it used to be perfectly able to continue under XP. (That's the entire reason the exception handler in the main loop is there, for heaven's sake!)

Is there any way to fix this? Preferably in my code itself and not just on my computer, so it won't screw up on other systems?

like image 800
Mason Wheeler Avatar asked Jun 12 '09 19:06

Mason Wheeler


People also ask

How do you handle exceptions in a program?

To handle the exception, we have put the code, 5 / 0 inside the try block. Now when an exception occurs, the rest of the code inside the try block is skipped. The catch block catches the exception and statements inside the catch block is executed.

How do I avoid exceptions?

Another way to avoid exceptions is to return null (or default) for most common error cases instead of throwing an exception. A common error case can be considered a normal flow of control. By returning null (or default) in these cases, you minimize the performance impact to an app.


1 Answers

Check to ensure that the global variable in System, JITEnable is still set to 0. If that variable is set to 1, hardware (and external) exceptions will cause that behavior by calling UnhandledExceptionFilter. If it is set to 2, any exception will cause it.

like image 136
Allen Bauer Avatar answered Nov 15 '22 18:11

Allen Bauer