Share via


Debugger2.Breakpoints Property

Gets a collection of breakpoints.

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

Syntax

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

Property Value

Type: EnvDTE.Breakpoints
A Breakpoints collection.

Remarks

Breakpoints gets the collection of all breakpoints set in the debugger. This collection represents the list of all pending breakpoints. See dbgBreakpointType for a description of pending and bound breakpoints.

Examples

The following example demonstrates how to use the Breakpoints property.

To test this property:

  1. Open the target project and run the add-in.
public static void Breakpoints(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("Breakpoints 
    Property");
    owp.Activate();

    // dte is a reference to the DTE2 object passed to you by the
    // OnConnection method that you implement when you create an Add-in.
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;

    // Set breakpoints.  
    debugger.Breakpoints.Add("","Target001.cs", 13, 1, "", 
        
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, 
        "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);
    debugger.Breakpoints.Add("","Target001.cs", 14, 1, "", 
        
EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, 
        "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);            

    owp.OutputString("Number of breakpoints set: " + 
                     debugger.Breakpoints.Count + "\n");

    // List all breakpoints.
    foreach(EnvDTE80.Breakpoint2 bp in debugger.Breakpoints)
    {
        owp.OutputString(bp.Name + "\n");
    }
}
Sub ListAllBreakpoints()
    ' This function dumps the names of all the breakpoints 
    ' currently set 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")

    Dim bps As Breakpoints
    bps = DTE2.Debugger.Breakpoints

    If (bps.Count > 0) Then
        Dim bp As Breakpoint2
        For Each bp In bps
            bppane.OutputString(bp.Name + vbCrLf)
        Next
    Else
        bppane.OutputString("No breakpoints are set" + vbCrLf)
    End If
End Sub

.NET Framework Security

See Also

Reference

Debugger2 Interface

EnvDTE80 Namespace