Friday, June 24, 2011

DevTnT v2.1 – Visual Studio/ReSharper: Alternative shortcut for Attach to Process command

If you need to attach to a process from Visual Studio 2010 there is the obvious way to go via the Debug menu:

Attach to Process in Debug menu

But as a dev you might want to avoid using the mouse as much as possible and therefore look for a shortcut for this. Although there is no explicit shortcut for that command, one can always operate the menu via Alt-shortcuts. Unfortunately, the shortcut P is used for two commands, not just for our “Attach to Process”, but also for “Import Data Tips” (who uses that?). So, that might be ambiguous.

BTW, there is also a similar issue on Microsoft Connect:

Strangely, there is another menu containing the Attach to Process command, namely the Tools menu:

Attach to Process in Tools menu

Funny as it is we see here, that in fact there is a shortcut attached to our desired command: Cltr+Alt+P.

The Problem

Great and done? Not if you’re using ReSharper. Because Ctrl+Alt+P is ReSharper’s shortcut for the Introduce Parameter refactoring.

Looking to the command mappings for the shortcut, we see that the Visual Studio shortcut is defined for the global scope, while the ReSharper-shortcut is defined for the scope of the text editor:

Shortcut mappings for Ctrl+Alt+P with ReSharper installed That situation means that every time you have the input focus on any kind of text editor window (what you might have most of the time), the shortcut Ctrl+Alt+P will trigger ReSharper, but not Visual Studio Attacht to Process command.

The Solution

Having understood that, it is obvious what to do: Just move the focus to some non text editor window and press the shortcut then. I prefer moving the focus to the solution explorer using Ctrl+Alt+L. Then, the key for P is next to no additional effort.

So, train your fingers to Ctrl+Alt+L, P for the Attach to Process command!

Final remark

This is a typical situation where something looked just broken, but made totally sense when understood. So please, think twice before yelling out all too loud! :)


  1. Awesome. Thank you. Saved me a headache.

  2. This comment has been removed by the author.

  3. The polygraph has somewhere around 4 and 6 sensors appended to it while the free end is connected to the talked with