Search code examples
visual-studiovisual-studio-2013envdtevsixvspackage

Keyboard shortcuts not working after process attach (Visual Studio 2013 bug during debugging)


I've written small VSIX plugin which is able to attach debugger to particular process. This process is written using c# and c++ code, so I need to attach to it using both managed and native engines. From Visual Studio it can be achieved simply by selecting these engines from window opened by DEBUG -> Attach to process... -> Select...:

enter image description here

Below, I've shown the code sample which basically does the same thing, using Process2.Attach2 (MSDN):

EnvDTE80.DTE2 dte = GetService(typeof(SDTE)) as EnvDTE80.DTE2;
EnvDTE80.Debugger2 dteDebugger = dte.Debugger as EnvDTE80.Debugger2;
EnvDTE80.Transport transport = dteDebugger.Transports.Item("default");
EnvDTE80.Engine[] engines = new[] { transport.Engines.Item("managed/native") };
process.Attach2(engines);

Unfortunately, the very same code which works for VS2012, doesn't work for VS2013 (Update 1).

What I've noticed is keyboard problems. Visual Studio doesn't react for pressing key shortcuts. For example, if I press F10, debugger does nothing. If I want to step over any breakpoint, I need to use mouse instead and access context menu: DEBUG -> Step Over, etc.

It's annoying, I need the keyboard to control debugger. Has anyone noticed this problem and solved it already?

BTW: If I use managed engine only (transport.Engines.Item("managed")), the keyboard starts to work correctly. But because I need to debug through unmanaged code also, I need additional engine - the native one.

EDIT: I've reported it also to Microsoft Connect network.


Solution

  • I've found temporary workaround. To fix that issue I opened TOOLS -> Options... -> Debugging -> General and checked Use Managed Compatibility Mode option:

    enter image description here

    What's more, this change paradoxically fixes another, seemingly unrelated issue, namely evaluation of expressions in Watch or Immediate windows for some particular cases (which I also noticed few days ago).

    UPDATE:

    I've detected this issue using Microsoft Visual Studio Premium 2013, Version 12.0.30110.00 Update 1

    After installation of Version 12.0.30219.00 Update 2 CTP, this problem is no longer reproducible for me.