Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

OnEnterBreakMode does not fire

$
0
0
Running VS 2012.  I created an add-in.  I want to handle the OnEnterBreakMode event.  The Exec method is called.  I tried returning handled = true/false.  The handler is never invoked.  I tried a few variations of DTE and DTE2.  I go to the Tools menu > click "MyAddIn1" and the Exec method is called.  I verified the event is bound.  I do not know how the life cycle of an add-in works.  

`StartEvents` is not an override and it's not connected to anything.  I find that strange...

    
 public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
    {
    handled = false;
    if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
    {
    if(commandName == "MyAddin1.Connect.MyAddin1")
    {
    //handled = true;
                        // Place the following code in the Exec method of the add-in:                           
                        EnvDTE.DebuggerEvents debugEvents = _applicationObject.Events.DebuggerEvents;
                        debugEvents.OnEnterBreakMode += new _dispDebuggerEvents_OnEnterBreakModeEventHandler(Connect.BreakHandler);
    return;
    }
    }
    }
    private DTE _applicationObject;
    private AddIn _addInInstance;
            // Place the following Event handler code in the add-in:
            // Needed to activate event handlers in Connect.Exec.
            public static void StartEvents(DTE dte)
            {
                Console.WriteLine("Events are attached.");
            }
            // OnEnterBreakMode Event.
            public static void BreakHandler(dbgEventReason reason, ref dbgExecutionAction execAction)
            {
                Console.WriteLine("Debugger enters break mode. " + "Reason: " + reason.ToString());
            }



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>