Export (0) Print
Expand All

Debugger.CurrentMode Property

Gets the current mode of the debugger within the context of the integrated development environment (IDE).

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

dbgDebugMode CurrentMode { get; }

Property Value

Type: EnvDTE.dbgDebugMode
A dbgDebugMode value.

The following example demonstrates how to use the CurrentMode property.

To test this property:

  1. Design Mode: open the target application and run the add-in.

  2. Break Mode: set a breakpoint in the target application and run it. When the application stops at the breakpoint, run the add-in.

  3. Run Mode: run the target application in the debug mode. Use an infinite loop in the application program. Run the add-in.

public static void CurrentMode(DTE dte)
{
    // 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("Current Mode Test");
    owp.Activate();

    owp.OutputString("Current Mode: ");
    switch(dte.Debugger.CurrentMode)
    {
        case dbgDebugMode.dbgDesignMode:
            owp.OutputString("Design Mode");
            break;
        case dbgDebugMode.dbgBreakMode:
            owp.OutputString("Break Mode");
            break;
        case dbgDebugMode.dbgRunMode:
            owp.OutputString("Run Mode");
            break;
    }
}

Show:
© 2014 Microsoft