Partager via


Debugger2.RunToCursor, méthode

Exécute le programme jusqu'à la position actuelle du curseur du fichier source.

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

Syntaxe

'Déclaration
Sub RunToCursor ( _
    WaitForBreakOrEnd As Boolean _
)
void RunToCursor(
    bool WaitForBreakOrEnd
)
void RunToCursor(
    [InAttribute] bool WaitForBreakOrEnd
)
abstract RunToCursor : 
        WaitForBreakOrEnd:bool -> unit
function RunToCursor(
    WaitForBreakOrEnd : boolean
)

Paramètres

  • WaitForBreakOrEnd
    Type : Boolean

    Affectez la valeur true si cet appel de fonction doit attendre que le mode Arrêt ou Design soit activé avant de retourner une valeur. Affectez la valeur false si vous souhaitez que cet appel retourne immédiatement une valeur après avoir provoqué le début de l'exécution du débogueur. Après le retour, le débogueur peut être en mode Design, Arrêt ou Exécution.

    Pour plus d'informations, consultez la présentation du code pas à pas.

Notes

RunToCursor exécute le programme à la position actuelle du curseur de fichier source. Pour plus d'informations, consultez <PAVEOVER> Comment : exécuter jusqu'à un emplacement spécifié.

Exemples

L'exemple suivant montre comment utiliser la méthode RunToCursor.

Pour tester cette méthode :

  1. Ouvrez le projet cible et exécutez le complément.
public static void RunToCursor(EnvDTE80.DTE2 dte)
{
    EnvDTE.TextSelection ts = 
    (EnvDTE.TextSelection)dte.ActiveDocument.Selection;
    ts.GotoLine(15, false);
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;

    debugger.RunToCursor(true);

    // Setup 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("RunToCursor Method 
    Test");
    owp.Activate();
    if (debugger.CurrentProgram.IsBeingDebugged)
        owp.OutputString("This program is being debugged and " +
                         "the cursor is on line: " + ts.CurrentLine);
    else
        owp.OutputString("This program is not being debugged.");
}
Sub RunToLine(Optional ByVal line As Integer = -1)
    If line <> -1 Then
        Dim ts As TextSelection
        ts = DTE2.ActiveDocument.Selection
        ts.GotoLine(line)
        DTE2.Debugger.RunToCursor()
    End If
End Sub

Sécurité .NET Framework

Voir aussi

Référence

Debugger2 Interface

EnvDTE80, espace de noms