This documentation is archived and is not being maintained.

Debugger.CurrentStackFrame Property

Sets or gets the current stack frame.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

StackFrame CurrentStackFrame { get; set; }
/** @property */
StackFrame get_CurrentStackFrame ()

/** @property */
void set_CurrentStackFrame (/** @attribute InAttribute() */ StackFrame StackFrame)

function get CurrentStackFrame () : StackFrame

function set CurrentStackFrame (StackFrame : StackFrame)

Property Value

A StackFrame object.

CurrentStackFrame sets or returns a StackFrame object. See Memory Management: Frame Allocation for more information about the stack frame.

The following example demonstrates how to use the CurrentStackFrame property.

To test this property:

  1. Set a breakpoint in the target application. Run the add-in.

    The current stack frame is empty.

  2. Set a breakpoint in the target application. Run the target application in the debug mode. When the program stops at the breakpoint, run the add-in.

    The current stack frame contains the method name and the return type.

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.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.");
        owp.OutputString("Function " + sf.FunctionName + 
                         " returns type " + sf.ReturnType);