4

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?

user3114639
  • 1,895
  • 16
  • 42
  • The simplest explanation is that OnConnection() didn't get called. Add logging. – Hans Passant Dec 30 '13 at 13:08
  • no, OnConnection() called. (I edited that in the question). – user3114639 Dec 30 '13 at 13:16
  • There is no record of a problem with the event, nothing at connect.microsoft.com. Your snippet is quite inadequate to give anybody here a shot at reproducing the problem. You cannot get support from Microsoft for this, the event is documented as "not intended to be used directly from your code". The best way to move ahead is to repro it in VS2013 and then file a report at connect.microsoft.com. You must include the full source code of your add-in so they can repro it. – Hans Passant Dec 30 '13 at 13:24
  • See the following sample as a working reference of OnEnterRunMode: http://vlasovstudio.com/visual-commander/extensions.html#minimize_vs_on_debug – Sergey Vlasov Dec 31 '13 at 05:41

1 Answers1

4

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.

user3114639
  • 1,895
  • 16
  • 42