Monday, 10 November 2014

Visual Studio Does Not Show Unhandled Exception Message on a 64-bit version of Windows (Silent Exceptions x64)

Silent exceptions on x64 development machines

Have you ever expected an exception to present itself in Visual Studio but the application seemed to play it cool and continue to run (With very unexpected results ensued!)? Then you may have experienced Silent Exception Syndrome! This seems to occur all in 64bit versions of Windows prior to Windows 8 (Vista, 7 etc...)

The Cause
When a user mode exception crosses a kernel transition, x64 versions of Windows do not allow the exception to propagate. Therefore attached debuggers are unaware of the fact that an exception occured resulting in the debugger failing to break on the unhandled exception.

Work Around
This is a known bug with x64 versions of Windows and the way exceptions are handled. One way to work around this issue while debugging is to go to the Debug -> Exceptions and select 'Thrown' for for the exception types you are interested in. This will stop the debugger when the exception is first hit (and before Windows eats it up).

Permanent Fix
Install this Hot Fix

More Information
http://blog.paulbetts.org/index.php/2010/07/20/the-case-of-the-disappearing-onload-exception-user-mode-callback-exceptions-in-x64/

No comments: