Share via


Debugger2.BreakpointLastHit Property

Gets the last breakpoint hit.

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

Syntax

'Declaration
ReadOnly Property BreakpointLastHit As Breakpoint
'Usage
Dim instance As Debugger2 
Dim value As Breakpoint 

value = instance.BreakpointLastHit
Breakpoint BreakpointLastHit { get; }
property Breakpoint^ BreakpointLastHit {
    Breakpoint^ get ();
}
function get BreakpointLastHit () : Breakpoint

Property Value

Type: EnvDTE.Breakpoint
A Breakpoint object.

Implements

Debugger.BreakpointLastHit

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 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(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();

    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)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 = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object

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

.NET Framework Security

See Also

Reference

Debugger2 Interface

Debugger2 Members

BreakpointLastHit Overload

EnvDTE80 Namespace