Jaa


Exception handling (Visual Studio SDK)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The following describes the process that occurs when exceptions are thrown.

Exception handling process

  1. 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.

  2. The SDM calls IDebugExceptionEvent2::GetException to get the property of exception.

  3. The debug package calls IDebugExceptionEvent2::CanPassToDebuggee to determine what options to present to the user.

  4. The debug package asks the user how to handle the exception by opening a first-chance exception dialog box.

  5. 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.

  6. 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.

  7. The debug package asks the user how to handle the exception by opening a first-chance exception dialog box.

  8. The debug package calls IDebugExceptionEvent2::CanPassToDebuggee to determine what options to present to the user.

  9. The debug package asks the user how to handle the exception by opening a second-chance exception dialog box.

  10. If the method returns S_OK, calls IDebugExceptionEvent2::PassToDebuggee.

See also