Поделиться через


Breakpoint.FunctionName - свойство

Возвращает имя функции, в которой задана точка останова.

Пространство имен:  EnvDTE
Сборка:  EnvDTE (в EnvDTE.dll)

Синтаксис

'Декларация
ReadOnly Property FunctionName As String
string FunctionName { get; }
property String^ FunctionName {
    String^ get ();
}
abstract FunctionName : string
function get FunctionName () : String

Значение свойства

Тип: System.String
Строка, представляющая имя функции.

Примеры

В следующем примере демонстрируется применение свойства FunctionName.

Тестирование данного свойства:

  1. Задайте в приложении точку останова.

  2. Запустите надстройку.

public static void FunctionName(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("FunctionName property: ");
    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 FunctionName(ByRef dte As EnvDTE.DTE)
    Dim strFile As String
    Dim strFileLine As String
    Dim strFileColumn As String
    Dim strEnabled As String
    Dim strFunctionName 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()
    strFunctionName = dte.Debugger.Breakpoints.Item(1).FunctionName.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 + ".")
    MessageBox.Show("This breakpoint is in the function: " + strFunctionName + ".")
End Sub

Безопасность платформы .NET Framework

См. также

Ссылки

Breakpoint Интерфейс

EnvDTE - пространство имен

Другие ресурсы

Практическое руководство. Компиляция и выполнение примеров кода модели объектов автоматизации