CurrentStackFrame Property
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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);
© 2015 Microsoft