This topic has not yet been rated - Rate this topic

Debugger3.LastBreakReason Property

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

Namespace:  EnvDTE90
Assembly:  EnvDTE90 (in EnvDTE90.dll)
dbgEventReason LastBreakReason { get; }

Property Value

Type: EnvDTE.dbgEventReason
A dbgEventReason value.

Implements

Debugger2.LastBreakReason

A program can be broken, for example, for some of the following reasons:

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

For a complete list of enumerations, see dbgEventReason.

The following example shows 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(EnvDTE80.DTE2 dte)
{
    // Setup 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.Activate();

    owp.OutputString("The reason that a program was broken: ");
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    switch (debugger.LastBreakReason)
    {
        case dbgEventReason.dbgEventReasonBreakpoint:
            owp.OutputString("Breakpoint hit.");
            break;
        case dbgEventReason.dbgEventReasonNone:
            owp.OutputString("No reason");
            break;
        case dbgEventReason.dbgEventReasonExceptionNotHandled:
            owp.OutputString("Exception not handled by the debuggee");
            break;
        case dbgEventReason.dbgEventReasonExceptionThrown:
            owp.OutputString("Exception thrown");
            break;
    }
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Advertisement