Compartilhar via


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)

Syntax

'Declaration
Public Overridable Event OnEnterRunMode As _dispDebuggerEvents_OnEnterRunModeEventHandler
public virtual event _dispDebuggerEvents_OnEnterRunModeEventHandler OnEnterRunMode
public:
virtual   event _dispDebuggerEvents_OnEnterRunModeEventHandler^ OnEnterRunMode {
    void add (_dispDebuggerEvents_OnEnterRunModeEventHandler^ value);
    void remove (_dispDebuggerEvents_OnEnterRunModeEventHandler^ value);
}
abstract OnEnterRunMode : IEvent<_dispDebuggerEvents_OnEnterRunModeEventHandler,
    EventArgs>
override OnEnterRunMode : IEvent<_dispDebuggerEvents_OnEnterRunModeEventHandler,
    EventArgs>
JScript does not support events.

Implements

_dispDebuggerEvents_Event.OnEnterRunMode

Remarks

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.

Examples

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.");
}

.NET Framework Security

See Also

Reference

DebuggerEventsClass Class

EnvDTE Namespace