Export (0) Print
Expand All

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)

public virtual event _dispDebuggerEvents_OnEnterBreakModeEventHandler OnEnterBreakMode



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.

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

© 2014 Microsoft