This documentation is archived and is not being maintained.

Debugger.BreakpointLastHit Property

Gets the last breakpoint hit.

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

Breakpoint BreakpointLastHit { get; }
/** @property */
Breakpoint get_BreakpointLastHit ()

function get BreakpointLastHit () : Breakpoint

Property Value

A Breakpoint object.

BreakpointLastHit returns a bound Breakpoint object that was the last breakpoint hit by the debugger. If the debugger hit multiple breakpoints simultaneously, this property returns one of the breakpoints; it does not define which breakpoint is returned. To see a collection of multiple breakpoints hit simultaneously, see AllBreakpointsLastHit.

The following example demonstrates how to use the BreakpointLastHit property.

To test this property:

  1. Set several breakpoints in the target application.

  2. Run the target application in the debug mode.

  3. When the application stops at the breakpoint, run the add-in.

public static void BreakpointLastHit(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("Breakpoint Last Hit Test");

    owp.OutputString("Breakpoint last hit: " + dte.Debugger.BreakpointLastHit.Name);