Compartir a través de


Debugger.CurrentStackFrame Property

Sets or gets the current stack frame.

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

Syntax

'Declaration
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)

Property Value

Type: EnvDTE.StackFrame
A StackFrame object.

Remarks

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

Examples

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.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 Security

See Also

Reference

Debugger Interface

EnvDTE Namespace