Export (0) Print
Expand All

Debugger.RunToCursor Method

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

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

void RunToCursor (
	[OptionalAttribute] [InAttribute] bool WaitForBreakOrEnd
)
void RunToCursor (
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ boolean WaitForBreakOrEnd
)
function RunToCursor (
	WaitForBreakOrEnd : boolean
)

Parameters

WaitForBreakOrEnd

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.

See Stepping for more information.

RunToCursor executes the program to the current position of the source file cursor. See Running to a Specified Location for more information.

The following example demonstrates how to use the RunToCursor method.

To test this method:

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

public static void RunToCursor(DTE dte)
{
    EnvDTE.TextSelection ts = (EnvDTE.TextSelection)dte.ActiveDocument.Selection;
    ts.GotoLine(15, false);
    dte.Debugger.RunToCursor(true);

    // 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("RunToCursor Method Test");
    owp.Activate();
    if(dte.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.");
}

Community Additions

ADD
Show:
© 2014 Microsoft