Share via


Debugger3.BreakpointLastHit Property

Gets the last breakpoint hit.

Namespace:  EnvDTE90
Assembly:  EnvDTE90 (in EnvDTE90.dll)

Syntax

'Declaration
ReadOnly Property BreakpointLastHit As Breakpoint
Breakpoint BreakpointLastHit { get; }
property Breakpoint^ BreakpointLastHit {
    Breakpoint^ get ();
}
abstract BreakpointLastHit : Breakpoint with get
function get BreakpointLastHit () : Breakpoint

Property Value

Type: EnvDTE.Breakpoint
A Breakpoint object.

Remarks

BreakpointLastHit gets a bound Breakpoint 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.

Examples

The following example shows 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(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("Breakpoint Last 
    Hit Test");
    owp.Activate();

    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    owp.OutputString("Breakpoint last hit: " +
                     debugger.BreakpointLastHit.Name);
}
Sub BreakpointLastHit()
    ' This function dumps the name of the breakpoints last hit to
    ' a new pane in the Output window.
    Dim ow As OutputWindow
    ow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object

    Dim bppane As OutputWindowPane
    bppane = ow.OutputWindowPanes.Add("Debugger")
    bppane.OutputString(DTE.Debugger.BreakpointLastHit.Name + vbCrLf)
End Sub

.NET Framework Security

See Also

Reference

Debugger3 Interface

EnvDTE90 Namespace