Partager via


DebuggerEventsClass.OnEnterBreakMode Event

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

Fired when entering break mode.

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

Syntax

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

Implements

_dispDebuggerEvents_Event.OnEnterBreakMode

Remarks

Reflecting the overall state of the debugger, this event is fired when the debugger enters break mode. This event is fired regardless of how break mode is established.

See CurrentMode property and <PAVEOVER> 12/13 How to: Break Execution for more information about break mode.

Examples

The following example demonstrates how to use the OnEnterBreakMode event.

To test this event:

  1. Open the target application.

  2. Run the add-in.

    Observe the message box: "Events are attached."

  3. Set a breakpoint and run the target application in the debug mode.

    Observe the message box: ""Debugger enters break mode. Reason: dbgEventReasonBreakpoint."

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

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

// OnEnterBreakMode Event.
public static void BreakHandler(dbgEventReason reason, ref dbgExecutionAction execAction)
{
    System.Windows.Forms.MessageBox.Show("Debugger enters break mode. " + 
                                         "Reason: " + reason.ToString());
}

.NET Framework Security

See Also

Reference

DebuggerEventsClass Class

EnvDTE Namespace