This topic has not yet been rated - Rate this topic

Debugger3.RunToCursor Method (Boolean)

Executes the program to the current position of the source file cursor.

Namespace:  EnvDTE90
Assembly:  EnvDTE90 (in EnvDTE90.dll)
void RunToCursor(
	bool WaitForBreakOrEnd
)

Parameters

WaitForBreakOrEnd
Type: System.Boolean
Set to true if this function call should wait until either Break mode or Design mode is entered before returning. Set to false if you want this call to return immediately after causing the debugger to begin execution. Upon return the debugger could be in Design, Break, or Run modes.
For more information, see Code Stepping Overview.

Implements

Debugger2.RunToCursor(Boolean)

RunToCursor executes the program to the current position of the source file cursor. For more information, see How to: Run to a Specified Location.

The following example shows how to use the RunToCursor method.

To test this method:

  • Open the target project and run the add-in.

public static void RunToCursor(EnvDTE80.DTE2 dte)
{
    EnvDTE.TextSelection ts = 
    (EnvDTE.TextSelection)dte.ActiveDocument.Selection;
    ts.GotoLine(15, false);
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)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.");
}

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Advertisement