次の方法で共有


Debugger.CurrentThread Property

Definition

Sets or gets the current thread being debugged.

public:
 property EnvDTE::Thread ^ CurrentThread { EnvDTE::Thread ^ get(); void set(EnvDTE::Thread ^ value); };
public:
 property EnvDTE::Thread ^ CurrentThread { EnvDTE::Thread ^ get(); void set(EnvDTE::Thread ^ value); };
[System.Runtime.InteropServices.DispId(105)]
public EnvDTE.Thread CurrentThread { [System.Runtime.InteropServices.DispId(105)] get; [System.Runtime.InteropServices.DispId(105)] set; }
[<System.Runtime.InteropServices.DispId(105)>]
[<get: System.Runtime.InteropServices.DispId(105)>]
[<set: System.Runtime.InteropServices.DispId(105)>]
member this.CurrentThread : EnvDTE.Thread with get, set
Public Property CurrentThread As Thread

Property Value

A Thread object.

Attributes

Examples

The following example demonstrates how to use the CurrentThread property.

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  

Remarks

CurrentThread sets or returns the Thread object being currently debugged.

Applies to