Debugger.Stop Method

Stops debugging, terminating, or detaching from all attached processes.

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

void Stop(
	bool WaitForDesignMode


Type: System.Boolean

Set to true if the debugging session should stop only when it reaches design mode. Set to false if you intend to stop debugging, but you need to perform other tasks in the macro even before the debugger enters Design mode.

Stop stops debugging and terminates the attached process. See <PAVEOVER> How to: Stop Debugging or Stop Execution for more information.

The following example demonstrates how to use the Stop method.

To test this method:

  1. Set a breakpoint in the target application.

  2. Run the target application in Debug mode.

  3. When the application stops at the breakpoint, run the add-in.

public static void Stop(DTE dte)
    EnvDTE.Debugger debugger = (EnvDTE.Debugger)dte.Debugger;

Macros are run on the main thread of Visual Studio. The following code does not work and the macro loops indefinitely, because the integrated development environment (IDE) never has a chance to enter Design mode. Instead, you should resort to a separate thread or pooling mechanism.

' Bad Code Example.
Sub StopDebuggingAndWaitForDesign

    While DTE.Debugger.CurrentMode <> dbgDebugMode.dbgDesignMode
    End While

    MsgBox("Debugger has been stopped")

End Sub

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft