DebuggerEventsClass.OnEnterRunMode Event

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Fired when the debugger enters run mode.

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

public virtual event _dispDebuggerEvents_OnEnterRunModeEventHandler OnEnterRunMode



Reflecting the overall state of the debugger, this event is fired when the debugger enters run mode. This event may not fire when stepping through code. Typically, it is best used when updating the user interface. See the CurrentMode property for more information.

The following example demonstrates how to use the OnEnterRunMode event.

To test this event:

  1. Open the target application.

    The application must contain an infinite loop.

  2. Run the add-in.

    Observe the message box: "Events are attached."

  3. Run the target application in the debug mode.

    Observe the message box: "Debugger enters run mode."

// Place the following code in the Exec method of the add-in:
EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents;
debugEvents.OnEnterRunMode += 
new _dispDebuggerEvents_OnEnterRunModeEventHandler(DebuggerEvents.RunHandler);

// Place the following Event handler code in the add-in:
// Needed to activate event handlers in Connect.Exec.
public static void StartEvents(DTE dte)
    System.Windows.Forms.MessageBox.Show("Events are attached.");

// OnEnterRunMode Event.
public static void RunHandler(dbgEventReason reason)
    System.Windows.Forms.MessageBox.Show("Debugger enters run mode.");

Community Additions