Partager via


Debugger3.CurrentThread, propriété

Obtient ou définit le thread actuellement en cours de débogage.

Espace de noms :  EnvDTE90
Assembly :  EnvDTE90 (dans EnvDTE90.dll)

Syntaxe

'Déclaration
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)

Valeur de propriété

Type : EnvDTE.Thread
un objet Thread.

Implémentations

Debugger2.CurrentThread

Exemples

L'exemple suivant montre comment utiliser la propriété CurrentThread.

Pour tester cette propriété :

  1. Définissez un point d'arrêt dans l'application cible. Exécutez le complément.

    Le thread actuel est vide.

  2. Définissez un point d'arrêt dans l'application cible. Exécutez l'application cible en mode débogage. Lorsque le programme s'arrête au point d'arrêt, exécutez le complément.

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

    owp.OutputString("Current Thread Info: ");
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    EnvDTE.Thread thread = 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);
}
Sub ShowCurrentProcess()
    ' This function displays the current debugger
    ' mode in the Output window.
    Dim ow As OutputWindow
    ow = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object

    Dim proc As EnvDTE.Process2
    proc = DTE2.Debugger.CurrentProcess

    If (proc Is Nothing) Then
        ow.ActivePane.OutputString("No process is being debugged")
    Else
        ow.ActivePane.OutputString("" + Str(proc.ProcessID) + ": " + _
        poc.Name + vbCrLf)
    End If
End Sub

Sécurité .NET Framework

Voir aussi

Référence

Debugger3 Interface

CurrentThread, surcharge

EnvDTE90, espace de noms