Sdílet prostřednictvím


Debugger.CurrentThread – vlastnost

Nastaví nebo získá aktuální podproces laděné.

Obor názvů:  EnvDTE
Sestavení:  EnvDTE (v EnvDTE.dll)

Syntaxe

'Deklarace
Property CurrentThread As Thread
    Get
    Set
Thread CurrentThread { get; set; }
property Thread^ CurrentThread {
    Thread^ get ();
    void set (Thread^ value);
}
abstract CurrentThread : Thread with get, set
function get CurrentThread () : Thread
function set CurrentThread (value : Thread)

Hodnota vlastnosti

Typ: EnvDTE.Thread
A Thread objektu.

Poznámky

CurrentThreadNastaví nebo vrátí Thread objekt aktuálně laděné.

Příklady

Následující příklad demonstruje použití CurrentThread vlastnost.

Tato vlastnost testování:

  1. Nastavte zarážky v cílové aplikaci. Spusťte doplněk.

    Aktuální podproces je prázdný.

  2. Nastavte zarážky v cílové aplikaci. Cílová aplikace spouštět v režimu ladění. Doplněk spusťte po ukončení aplikace bod přerušení.

    Aktuální podproces není prázdný.

public static void CurrentThread(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("Current Thread Test");
    owp.Activate();

    owp.OutputString("Current Thread Info: ");
    EnvDTE.Thread thread = dte.Debugger.CurrentThread;

    if(thread == null)
        owp.OutputString("No program is being debugged");
    else
        foreach(EnvDTE.StackFrame sf in thread.StackFrames)
            owp.OutputString("\nStack Frame: Function " + sf.FunctionName + 
                             " returns type " + sf.ReturnType);
}
Shared Sub CurrentThread(ByRef dte As EnvDTE.DTE)
    Dim str As String
    Dim thread As EnvDTE.Thread = dte.Debugger.CurrentThread
    If thread Is Nothing Then
        MessageBox.Show("No program is being debugged.", _
                        "Debugger Test - Current Thread Info")
    Else
        For Each sf As EnvDTE.StackFrame In thread.StackFrames
            str += vbCrLf + "Stack Frame: Function " + _
                   sf.FunctionName.ToString() + " returns type " + _
                   sf.ReturnType
        Next
        MessageBox.Show(str, "Debugger Test - Current Thread Info")
    End If
End Sub

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

Debugger Rozhraní

EnvDTE – obor názvů