Debugger.RunToCursor 方法

執行程式前往原始程式檔游標目前的位置。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

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

參數

  • WaitForBreakOrEnd
    型別:System.Boolean
    設定為 true,表示這項函式呼叫在傳回之前必須等候,直到進入中斷模式或設計模式為止。設定為 false,表示您希望這項呼叫在引發偵錯工具開始執行之後,能夠立即傳回。傳回時,偵錯工具可能是在設計、中斷或執行模式下。
    如需詳細資訊,請參閱逐步執行。

備註

RunToCursor 會執行程式至原始程式檔游標目前的位置。如需詳細資訊,請參閱 HOW TO:執行至特定位置

範例

下列範例示範如何使用 RunToCursor 方法。

若要測試這個方法:

  1. 開啟目標專案並執行增益集。
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.");
}
Shared Sub RunToCursor(ByRef dte As EnvDTE.DTE)
    Dim ts As EnvDTE.TextSelection = dte.ActiveDocument.Selection
    ts.GotoLine(15, False)
    dte.Debugger.RunToCursor(True)
    If dte.Debugger.CurrentProgram.IsBeingDebugged Then
        MessageBox.Show("This program is being debugged and the cursor is on line: " + ts.CurrentLine.ToString(), _
                        "Debugger Test - RunToCursor Test")
    Else
        MessageBox.Show("This program is not being debugged.", _
                        "Debugger Test - RunToCursor Test")
    End If
End Sub

.NET Framework 安全性

請參閱

參考

Debugger 介面

EnvDTE 命名空間