Debugger2.Breakpoints 属性

获取断点的集合。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

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

属性值

类型:Breakpoints
一个 Breakpoints 集合。

备注

Breakpoints 获取在调试器中设置的所有断点的集合。 此集合表示所有挂起的断点的列表。 有关挂起和绑定断点的说明,请参见 dbgBreakpointType

示例

下面的示例演示如何使用 Breakpoints 属性。

测试此属性:

  1. 打开目标项目并运行外接程序。
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 安全性

请参阅

参考

Debugger2 接口

EnvDTE80 命名空间