다음을 통해 공유


Debugger3.CurrentThread 속성

디버깅하고 있는 현재 스레드를 가져오거나 설정합니다.

네임스페이스:  EnvDTE90
어셈블리:  EnvDTE90(EnvDTE90.dll)

구문

‘선언
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)

속성 값

형식: EnvDTE.Thread
Thread 개체입니다.

구현

Debugger2.CurrentThread

예제

다음 예제에서는 CurrentThread 속성을 사용하는 방법을 보여 줍니다.

이 속성을 테스트하려면

  1. 대상 응용 프로그램에 중단점을 설정합니다. 추가 기능을 실행합니다.

    현재 스레드가 비어 있습니다.

  2. 대상 응용 프로그램에 중단점을 설정합니다. 디버그 모드에서 대상 응용 프로그램을 실행합니다. 프로그램이 중단점에서 멈추면 추가 기능을 실행합니다.

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

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Debugger3 인터페이스

CurrentThread 오버로드

EnvDTE90 네임스페이스