How to disable F10/F11 unless I'm debugging in Visual Studio? - visual-studio

So I have this weird problem where I press keys subconsciously sometimes. F10 (step over) and F11 (step into) are two that I keep pressing... or if I meant to hit F12, sometimes I hit F11 accidently...
Anyway, this is a major annoyance since it starts a build, which takes a while, I immediately start spamming CTRL + BREAK to break the build, but it only rarely works; it seems that it just freezes or maybe there is only a short window of time where it does work? Then if the build succeeds, my configuration is set up to do a deploy as well, and often, VS just locks and I have to end the process with Task Manager and restart VS.
So just wondering if there is any possibility to only allow F10, F11 to work when pressed if I am debugging, where I actually need it (I use attach to process so F5/F10/F11 are useless shortcuts when not debugging)?
Thanks.

You can assign F10 to the following C# command for Visual Commander:
if (DTE.Mode == vsIDEMode.vsIDEModeDebug)
DTE.ExecuteCommand("Debug.StepOver");
It will call StepOver only when you are in the Debug mode. For F11 use Debug.StepInto.

I had the same problem - kept randomly hitting F11 instead of F12. I ended up re-assigning F10 and F11 to something innocuous (like Find Next / Previous) and then re-assigned StepOver / StepInto to Ctrl-' and ctrl-; respectively (these are the same shortcut keys used by the Chrome debugger).
Perhaps a bit extreme, but it works for me. I now have a new problem though where I occasionally invoke Find Next when debugging :) On balance the new problem is less annoying.

Related

Shortcut key to next breakpoint in Visual Studio

I'm using Visual Studio and would like to use the keyboard to go to the previous/next breakpoint. I had a look at Options|Environment|Keyboard but found no such command.
Is there a way to do it?
For people wanting to see each breakpoint, that ended up here. (Like me)
Try Debug -> Windows -> Breakpoints.
You can jump to breakpoints during debugging of application. Here is a list of shortcut keys that might help you.
Create or remove breakpoint on the current line: F9
Execute code one statement at a time, following execution into function calls (Step Into): F11
Execute the next line of code but not follow execution through any function calls (Step Over): F10
Execute the remaining lines of a function in which the current execution point lies (Step Out): SHIFT + F11
Restart a debugging session : CTRL + SHIFT + F5
Resume execution of your code from the current statement to the selected statement (Run to Cursor): CTRL + F10
Run the application (or jump to next breakpoint): F5
Use 'Run To Cursor' (CTRL+F10). The debugger will execute your application up to where your cursor is and break. For more details visit: How to skip over code in the Visual Studio Debugger
If you want to just want to navigate and not use debugger, I use an extension called Bookmarks by Alessandro Fragnani. It's super useful when you have to navigate forward and backwards through long lines of code on a page and even faster if you setup shortcut keys.
Here is how to Configure
I've configured mine shortcut key Manually

How to disable F12 to debug application in Visual Studio 2012

If I hit F12 while my application runs under Visual Studio in debug mode, the WM_KEYDOWN never reaches my event loop, but it immediately triggers a breakpoint. Is it possible to disable this feature, or reassign it to another, less conflicting hotkey (e.g. CTRL+F12)? I figure the must be a registry key, but I can't find it...
Any help is greatly appreciated!
F12 is a reserved key for the debugger and its kernel-based https://msdn.microsoft.com/en-us/library/windows/desktop/ms646309.aspx
But you can change the registry entry
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug] UserDebuggerHotKey=dword:00000000
to something else like 0x13 (Pause)
got this from http://conemu.github.io/en/GlobalHotKeys.html
You can disable it from Tools->options->Keyboard
It's easy to reassign a value like that to whatever you want.
1) Go to Tools/Options and click on Keyboard (under environment). Then find the command associated with F12. Which one depends on which mapping scheme you use, so I can't tell you the one to find.)
Then change it to whatever you want.
Too bad I can't add comments...
When I type in F12 (for Press shortcut keys), I get Edit.GoToDefinition. If I remove that assignment and then try again, it shows how it is used with Page Inspector.
If you enter F12 and nothing shows, then you can assume that VS is not using F12 and something else is.
You can just try assigning F12 to something and see if that is called instead - then at least you will have some idea of if VS is controlling it or something external to VS is.
Remember that you could also have some application that has remapped F12 so that when you press it, your application is getting a signal that some other key or key combination has been pressed (happened to me once.)

Keyboard random failure in Visual Studio 2010

I have not been able to track down why random actions in Visual studio 2010 will cause the keyboard and/or mouse to start performing different actions than anticipated or more often than not, stop responding to certain actions.
I never loose complete control, but I could return to VS from another screen and any of the following could occur:
Clicking on text with the mouse, acts like I have the shift key down and tries to highlight entire areas
arrow keys will no longer move the cursor
Delete, backspace or enter will stop responding
I am not sure that it is always after returning from running an application/debug, but that is definitely a majority of the times that I encounter the issue. Most of the time I have to completely shutdown VS and restart to get keyboard functionality back. Most of the time, other functions still work such as typing.
I should note, that I always check another application that those keys are responding as they are expected to verify it is only in VS that the problem is occurring.
Any thoughts?
I have occasionally, and for along time, seen "sticky" modifier keys (Ctrl, Alt, Shift) in VS, especially after quitting a debug session. For me it's usually the Ctrl key which turns Shift-F5 (stop debugging) into Ctrl-Shift-F5 (restart debugging). That's a bit frustrating.
The best fix I know is: when you notice this behavior, give each of the modifier keys a press to "un-stick" them, which sounds like what you're doing when you "check another application."

visual studio 2010 Step Into function doesn't work properly

Anyone else having issues with using F11 to step into code?
Until about an hour ago, I was able to perfectly step through code in both C# and C++ projects with ease, but now I suddenly have to press F11 at least 10 times before it will goto the next line. It's not even an issue of lag, as pressing and waiting has no result, it literally has to be hit 10 times every time I want to step into code. The same applies to the button on the GUI.
It started after playing with the Immediate and Command Window's (which are really useful by the way), I didn't use any commands that dealt with stepping into code, just commands for starting and stopping debugging.
Could I have accidentally enabled a "Make debugging retarded" option?
Googled everywhere for a solution, seems everyones had F11 problems but nothing like this, so any help is greatly appreciated

Visual Studio Debugger Issue

When I'm debugging in Visual Studio, I set a breakpoint where I want to start and press F5. When I continue pressing F11 to do a step by step process of how the program runs, when I get to a standard library function e.g std::cout the runs through all the steps in .
Is there anyway I can stop this and allow it to just be more localized? I've had a play with the settings but not stumbled across a way to do it.
I'm completely new to programming so I apologize if this is a simple fix.
Many Thanks
There are two other stepping commands that will likely be helpful to you:
Step Over (F10) - Steps over a function without going into it.
Step Out (Shift + F11) - Steps out of the current function.

Resources