Breakpoint.FileLine 属性

指示断点在文件中所处的行的位置。

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

语法

声明
ReadOnly Property FileLine As Integer
int FileLine { get; }
property int FileLine {
    int get ();
}
abstract FileLine : int with get
function get FileLine () : int

属性值

类型:Int32
一个整数,表示设置的断点在源代码中所处的行号,该行号从函数起始处算起。

备注

如果返回值为 1,则断点是在文件起始处设置的。 这是在“文件”下的“新建断点”对话框中的**“行”**框中指定的。

示例

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

测试此属性:

  1. 在目标应用程序中设置一个断点。

  2. 运行外接程序。

public static void FileLine(DTE 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("FileLine Property Test: ");
    owp.Activate();

    // dte is a reference to the DTE object passed to you by the
    // OnConnection method that you implement when you create an add-in.
    EnvDTE.Debugger debugger = (EnvDTE.Debugger)dte.Debugger;
    owp.OutputString("Breakpoint in the file " + debugger.Breakpoints.Item(1).File);
    owp.OutputString(" on line " + 
                     debugger.Breakpoints.Item(1).FileLine.ToString() + " column ");
    owp.OutputString(debugger.Breakpoints.Item(1).FileColumn.ToString() + " is ");
    owp.OutputString(debugger.Breakpoints.Item(1).Enabled ? "enabled." : "disabled.");
    owp.OutputString("\nThis breakpoint is in the function: " + 
                     debugger.Breakpoints.Item(1).FunctionName);
}
Shared Sub FileLine(ByRef dte As EnvDTE.DTE)
    Dim strFile As String
    Dim strFileLine As String
    Dim strFileColumn As String
    Dim strEnabled As String
    Dim boolEnabled As Boolean

    dte.Debugger.StepInto(True)
    dte.Debugger.Breakpoints.Add("", "Target001.cs", 15, 1, "", _
                                 EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _
                                 "C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)
    strFile = dte.Debugger.Breakpoints.Item(1).File.ToString()
    strFileLine = dte.Debugger.Breakpoints.Item(1).FileLine.ToString()
    strFileColumn = dte.Debugger.Breakpoints.Item(1).FileColumn.ToString()
    boolEnabled = dte.Debugger.Breakpoints.Item(1).Enabled
    If boolEnabled = True Then
        strEnabled = "enabled"
    Else
        strEnabled = "disabled"
    End If

    MessageBox.Show("Breakpoint in the file " + strFile + vbCrLf + _
                    "on line " + strFileLine + " column " + strFileColumn + _
                    " is " + strEnabled + ".")
End Sub

.NET Framework 安全性

请参阅

参考

Breakpoint 接口

EnvDTE 命名空间