Share via


Debugger3.CurrentMode Property

Gets the current mode of the debugger within the context of the IDE.

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

Syntax

'Declaration
ReadOnly Property CurrentMode As dbgDebugMode
    Get
dbgDebugMode CurrentMode { get; }
property dbgDebugMode CurrentMode {
    dbgDebugMode get ();
}
abstract CurrentMode : dbgDebugMode
function get CurrentMode () : dbgDebugMode

Property Value

Type: EnvDTE.dbgDebugMode
A dbgDebugMode value.

Implements

Debugger2.CurrentMode

Examples

The following example shows 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(EnvDTE80.DTE2 dte)
{
    // 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("Current Mode");
    owp.Activate();

    owp.OutputString("Current Mode: ");

    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;

    switch (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;
    }
}
Sub DebuggerMode()
    ' This function displays the current debugger mode in a new
    ' pane in the Output window.
    Dim ow As OutputWindow
    ow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object

    Dim bppane As OutputWindowPane
    bppane = ow.OutputWindowPanes.Add("Debugger")

    Select Case dte.Debugger3.CurrentMode
        Case dbgDebugMode.dbgBreakMode
            bppane.OutputString("Break Mode" + vbCrLf)
        Case dbgDebugMode.dbgDesignMode
            bppane.OutputString("Design Mode" + vbCrLf)
        Case dbgDebugMode.dbgRunMode
            bppane.OutputString("Run Mode" + vbCrLf)
    End Select
End Sub

.NET Framework Security

See Also

Reference

Debugger3 Interface

CurrentMode Overload

EnvDTE90 Namespace