次の方法で共有


Debugger.CurrentStackFrame プロパティ

現在のスタック フレームを設定または取得します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
Property CurrentStackFrame As StackFrame
StackFrame CurrentStackFrame { get; set; }
property StackFrame^ CurrentStackFrame {
    StackFrame^ get ();
    void set (StackFrame^ value);
}
abstract CurrentStackFrame : StackFrame with get, set
function get CurrentStackFrame () : StackFrame 
function set CurrentStackFrame (value : StackFrame)

プロパティ値

型 : EnvDTE.StackFrame
StackFrame オブジェクト。

解説

CurrentStackFrame は、StackFrame オブジェクトを設定するか、または返します。 スタック フレームの詳細については、「メモリ管理 : フレーム割り当て」を参照してください。

CurrentStackFrame プロパティを使用する方法を次の例に示します。

このプロパティをテストするには

  1. ターゲット アプリケーションにブレークポイントを設定します。 アドインを実行します。

    現在のスタック フレームは空です。

  2. ターゲット アプリケーションにブレークポイントを設定します。 ターゲット アプリケーションをデバッグ モードで実行します。 ブレークポイントでプログラムが停止したら、アドインを実行します。

    現在のスタック フレームには、メソッド名と戻り値の型が格納されています。

public static void CurrentStackFrame(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 StackFrame Test");
    owp.Activate();

    owp.OutputString("Current Stack Frame Info: ");
    EnvDTE.StackFrame sf = dte.Debugger.CurrentStackFrame;
    if(sf == null)
        owp.OutputString("No program is being debugged, Stack Frame is empty.");
    else
        owp.OutputString("Function " + sf.FunctionName + 
                         " returns type " + sf.ReturnType);
}
Shared Sub CurrentStackFrame(ByRef dte As EnvDTE.DTE)
    Dim sf As EnvDTE.StackFrame = dte.Debugger.CurrentStackFrame
    If sf Is Nothing Then
        MessageBox.Show("No program is being debugged, Stack Frame is empty.", _
                        "Debugger Test - Current Stack Frame Info")
    Else
        MessageBox.Show("Function " + sf.FunctionName + " returns type " + _
                        sf.ReturnType, "Debugger Test - Current Stack Frame Info")
    End If
End Sub

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Debugger インターフェイス

EnvDTE 名前空間