Click here to Skip to main content
15,889,281 members
Articles / Visual Studio
Reference

Visual Studio Tips - Keyboard Shortcuts for Debugging

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
3 Apr 2019CPOL2 min read 6.3K   5   1
Some useful Visual Studio keyboard shortcuts that are worth memorizing

There are literally hundreds of keyboard shortcuts in Visual Studio, and few people have them all memorized, but it is definitely worthwhile to memorize at least a few. Here are some that are useful while you’re debugging.

  • F5 - Run - This both starts the debugging session and continues the debugging session if the session is paused.
  • F10 - Step Over - This runs just the next statement. If the next statement is a function call, it runs the whole function before pausing execution again (unless there is a breakpoint in the function).
  • F11 - Step Into - This runs just the next statement. If the next statement is a function call, it will bring you to that function and pause before the first statement in there is run.
  • Shift+F11 - Step Out - This runs until the code returns from the currently running function. It’s really handy when you are done debugging a function, but that function still has a lot of statements to execute.
  • Ctrl+F10 - Run to Cursor - This allows you to move the cursor to a line of code then run until the debugger gets there. This is handy if you want to skip over a block of code. You could also press F9 then F5 which would add a Breakpoint at your cursor, then run to it.
  • Ctrl+Shift+F10 - Set Next Statement - This sets the line your cursor is on as the next statement the debugger will run. Really handy if you missed something and want to backup and debug it again.
  • Alt+Num * - Show Next Statement - Sorry laptop users, this one only works with the * on the number pad. This one takes you to the next statement that will run. Really handy if you’ve been sifting through code and want to quickly return to your debugging without executing any statements.
  • Shift+F5 - Stop Debugging - Ends your debugging session.
  • Ctrl+Shift+F5 - Restart Debugging - Getting the message “Edits were made to the code which cannot be applied while debugging”? This will quickly restart the debug session and have you on your way.

All of these are of course available through the UI, but if you often find yourself looking for them in the command bar, or right clicking and trying to find them in the context menu, memorizing at least some of these shortcuts will keep you focused on the debugging.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
I’m a Software Engineer at Microsoft working on the Azure Portal. Before that I spent about 20 years developed various business applications at a number of different companies. I have a passion for writing clean, scalable code and sharing what I’ve learned with others.

I also help run the Casco Bay .Net User Group

Comments and Discussions

 
QuestionSuggestion Pin
F Margueirat4-Apr-19 7:37
F Margueirat4-Apr-19 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.