Visual Studio - Prevent F11 from starting the debu

2020-08-09 05:27发布

Is there a way to prevent Visual studio to start the debugger when pressing F11? I often press it by mistake when I want to actually press F12. I do not want to loose the functionality of Step-into which F11 provides but it is annoying when it starts the application.

4条回答
迷人小祖宗
2楼-- · 2020-08-09 05:31

This is the suggestion on Microsoft's VS Community forum. Currently there is a suggestion from MSFT (I assume official MS dev?) that points to this free extension Tweaks:

Don't start debug on F10/F11 Inspired by the suggestion Please provide a way to disable F10/F11 until debug mode is entered.

F10 (Step Over) and F11 (Step Into) are two commands people often hit by accident. That starts a new debugging session and that can be annoying if you didn't mean for that to happen. They should only take effect during a debug session.

查看更多
可以哭但决不认输i
3楼-- · 2020-08-09 05:36

A hack-around that I use is to use the cancel build command after I accidentally hit F11. The default shortcut is ctrl+pause/break.

This doesn't stop F11 starting a build, but should stop it from running your program.

查看更多
再贱就再见
4楼-- · 2020-08-09 05:41

This is for VS 2010, but it should be similar for others.

In Tools->Options, open Keyboard under Environment. Look up the command Debug.StepInfo. You can remove the default shortcut (F11 (Global)) and then just use the toolbar button to step into, or right click and "Step into specific"--which is what I do since it keeps the debugger from diving into STL functions if they're part of a line of code (as an example).

查看更多
劳资没心,怎么记你
5楼-- · 2020-08-09 05:50

Install Resharper and Change the Key Short Settings

查看更多
登录 后发表回答