Udostępnij za pośrednictwem


Debugger2.CurrentMode Property

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

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

Syntax

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

Property Value

Type: EnvDTE.dbgDebugMode
A dbgDebugMode value.

Implements

Debugger.CurrentMode

Examples

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(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: ");

    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)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 = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object

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

    Select Case DTE2.Debugger.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

Debugger2 Interface

EnvDTE80 Namespace