Partager via


Debugger.CurrentStackFrame, propriété

Définit ou obtient le frame de pile actuel.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

'Déclaration
Property CurrentStackFrame As StackFrame
    Get
    Set
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)

Valeur de propriété

Type : EnvDTE.StackFrame
Objet StackFrame.

Notes

CurrentStackFrame définit ou retourne un objet StackFrame. Consultez Memory Management: Frame Allocation pour plus d'informations sur le frame de pile.

Exemples

L'exemple suivant montre comment utiliser la propriété CurrentStackFrame.

Pour tester cette propriété :

  1. Définissez un point d'arrêt dans l'application cible. Exécutez le complément.

    Le frame de pile actuel est vide.

  2. Définissez un point d'arrêt dans l'application cible. Exécutez l'application cible en mode débogage. Lorsque le programme s'arrête au point d'arrêt, exécutez le complément.

    Le frame de pile actuel contient le nom de méthode et le type de retour.

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

Sécurité .NET Framework

Voir aussi

Référence

Debugger Interface

EnvDTE, espace de noms