Exception Handling (Visual Studio SDK)
The following describes the process that occurs when exceptions are thrown.
Exception Handling Process
When an exception is first thrown, but before it is handled by the exception handler in the program being debugged, the debug engine (DE) sends an IDebugExceptionEvent2 to the session debug manager (SDM) as a stopping event. The IDebugExceptionEvent2 is sent if only the settings for the exception (specified in the Exceptions dialog box in the debug package) specify that the user wants to stop on first-chance exception notifications.
The SDM calls IDebugExceptionEvent2::GetException to get the property of exception.
The debug package calls IDebugExceptionEvent2::CanPassToDebuggee to determine what options to present to the user.
The debug package asks the user how to handle the exception by opening a first-chance exception dialog box.
If user chooses to continue, the SDM calls IDebugExceptionEvent2::CanPassToDebuggee.
If the method returns S_OK, calls IDebugExceptionEvent2::PassToDebuggee.
-or-
If the method returns S_FALSE, the program being debugged is given a second chance to handle the exception.
If the program being debugged has no handler for a second-chance exception, the DE sends an IDebugExceptionEvent2 to the SDM as EVENT_SYNC_STOP.
The debug package asks the user how to handle the exception by opening a first-chance exception dialog box.
The debug package calls IDebugExceptionEvent2::CanPassToDebuggee to determine what options to present to the user.
The debug package asks the user how to handle the exception by opening a second-chance exception dialog box.
If the method returns S_OK, calls IDebugExceptionEvent2::PassToDebuggee.