I have Add-in that run successfully in Visual Studio 2010, but when I run it in Visual Studio 2012 the DebuggerEvents.OnEnterRunMode Event doesn't fire. In the MSDN there is nothing about changes in DebuggerEvents events between Visual Studio 2010 and Visual Studio 2012.

My code is:

static DebuggerEvents dbgEvents;

    public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    {
     _applicationObject = (DTE2)application;
     _addInInstance = (AddIn)addInInst;

     dbgEvents = _applicationObject.Events.DebuggerEvents;

     ...

     if (registered)
       {
       return;
       }

    dbgEvents.OnEnterRunMode += new _dispDebuggerEvents_OnEnterRunModeEventHandler(DebuggerEvents_OnEnterRunMode);
    dbgEvents.OnEnterDesignMode += new _dispDebuggerEvents_OnEnterDesignModeEventHandler(dbgEvents_OnEnterDesignMode);
    registered = true;
   }
    void DebuggerEvents_OnEnterRunMode(dbgEventReason Reason)
     {
      ...
     }

OnConnection() and other events like SolutionEvents.Opened are fired, but when I click on 'start' to run project in visual studio, the event OnEnterRunMode doesn't called. any ideas?

有帮助吗?

解决方案

I found the solution:

The DebuggerEvents.OnEnterRunMode() event use EnvDTE.dll.

When the property of the EnvDTE.dll Embed Interop Types is True, the DebuggerEvents.OnEnterRunMode event doesn't fire.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top