Hi,
Our team is using a custom solution using the Visual Studio plugin system for building our code in Visual Studio. Basically what we are doing is to intercept all the build events, execute our own code to start the build and cancel the one executed by Visual
Studio. Recently, we did a migration of our code from VS2010 to VS2012. We observed some strange behavior with Debugger after doing the migration. Both the call to our version of the debugger and the one from Visual Studio are called.
I have written a short version of the code of our plugin to start the debugger:
using EnvDTE; public class DebuggerSystem : IDisposable { private DTE2 m_application; private CommandEvents m_debugStartEvent; public DebuggerSystem() { m_debugStartEvent = m_environment.ApplicationObject.Events.get_CommandEvents(null, 0); m_debugStartEvent.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(DebuggerEvent); } public void Dispose() { m_debugStartEvent.BeforeExecute -= DebuggerEvent; } private void DebuggerEvent(string guid, int id, object customIn, object customOut, ref bool cancelDefaultEvent) { string commandName = m_application.Commands.Item(guid, id).Name; if (commandName == "Debug.Start" || commandName == "ClassViewContextMenus.ClassViewProject.Debug.Startnewinstance") { DebugStartCommand(); cancelDefaultEvent = true; } } private void DebugStartCommand() { // My code to start my own debugger. } }
The summarize the problem, after executing our version of the debugger, we cancel the default event by setting the cancelDefaultEvent flag passed by reference to true, but the default Visual Studio Debugger is still started. We have two debugger running
at the same time. By experience, this used to work correctly in VS2010.
Thank you.