Compartir a través de


Debugger.BreakpointLastHit Property

Gets the last breakpoint hit.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.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 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.

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

    owp.OutputString("Breakpoint last hit: " + dte.Debugger.BreakpointLastHit.Name);
}
Shared Sub BreakpointLastHit(ByRef dte As EnvDTE.DTE)
    MessageBox.Show("Breakpoint last hit: " + dte.Debugger.BreakpointLastHit.Name, "Debugger Test")
End Sub

.NET Framework Security

See Also

Reference

Debugger Interface

EnvDTE Namespace