Share via


Why does the debugger block me to continue when I throw an Exception

It will only happen when we debug a managed application with the new Visual Studio 2005.  When the application throws an exception, the debugger may tell us that the exception is unhandled, and stops there.  When we try to hit F5 to resume the application, it will not go on.  However, we might find the exception is expected, that is especially true when we code with COM interfaces, and want to throw COMException to return an error.

The reason is that the new Visual Studio tries to unwind the exception when it thinks it hasn't been handled correctly, so the user could fix the problem before resuming the application.  It may be useful for beginners, but does brother us if the situation is expected.  To disable this behavior, we can uncheck the "Unwind the call stack on unhandled exceptions" in the debugger tool option page.  If the application being debugged is a managed/native mixed applcation, another option "Break when exceptions cross AppDomain or managed/native boundareis" may be interesting too.