Share via


Proprietà Debugger.CurrentThread

Imposta o ottiene il thread corrente in fase di debug.

Spazio dei nomi:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Sintassi

'Dichiarazione
Property CurrentThread As Thread
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)

Valore proprietà

Tipo: EnvDTE.Thread
In Thread oggetto.

Note

CurrentThread imposta o restituisce Thread oggetto attualmente in corso di debug.

Esempi

Nell'esempio seguente viene illustrato come utilizzare CurrentThread proprietà.

Per verificare questa proprietà:

  1. Impostare un punto di interruzione nell'applicazione di destinazione.eseguire il componente aggiuntivo.

    il thread corrente è vuoto.

  2. Impostare un punto di interruzione nell'applicazione di destinazione.Eseguire l'applicazione di destinazione in modalità di debug.Quando l'applicazione si interrompe al punto di interruzione, eseguire il componente aggiuntivo.

    il thread corrente non è vuoto.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Debugger Interfaccia

Spazio dei nomi EnvDTE