Export (0) Print
Expand All

Debugger.LastBreakReason Property

Gets the last reason that a program was broken. If the program is running it returns DBG_REASON_NONE.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

dbgEventReason LastBreakReason { get; }
/** @property */
dbgEventReason get_LastBreakReason ()

function get LastBreakReason () : dbgEventReason

Property Value

A dbgEventReason value.

LastBreakReason returns a dbgEventReason value indicating why a program broke. A program can be broken for one of the following reasons:

If nothing is being debugged or the debugger is in run mode, this property returns dbgEventReasonNone.

The following example demonstrates how to use the LastBreakReason property.

To test this property:

  1. Set a breakpoint in the target application. Run the add-in.

  2. Run the target application in the debug mode.

  3. Run the add-in.

public static void LastBreakReason(DTE dte)
    // Setup the debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Last Break Reason Test");

    owp.OutputString("The reason that a program was broken: ");
        case dbgEventReason.dbgEventReasonBreakpoint:
            owp.OutputString("Breakpoint hit.");
        case dbgEventReason.dbgEventReasonNone:
            owp.OutputString("No reason");
        case dbgEventReason.dbgEventReasonExceptionNotHandled:
            owp.OutputString("Exception not handled by the debuggee");
        case dbgEventReason.dbgEventReasonExceptionThrown:
            owp.OutputString("Exception thrown");

Community Additions

© 2014 Microsoft