Dot Net For All

Visual Studio Tips and Shortcut keys for fast debugging

Hello friends, In this article I will list down top 5 Visual Studio Shortcut keys that every developer should know. These shortcut keys helps to reduce the debugging time and hence increase the productivity.

These shortcut key combinations are on my finger tips, thus reducing my debugging time.

I am not a big fan of always pointing the mouse pointer to the menu items or tool box items in the visual studio, every time I want to do some action in Visual Studio.

List of Visual Studio shortcut keys for faster debugging

Ctrl + ‘-‘ -> Move backward

The combination of the control and hyphen(-) key is used to go back to the previous code or file from where we have just come.

If we are working on the larger code base, we have to go to and fro many number of times to look the previous code or condition.

You can use this key combination to keep going to previous locations where you have been.

Ctrl + Shift + ‘-‘ -> Move forward

Once you have come back to the previous location, you may want to go back to the currently working location.

This key combination moves you forward.

Ctrl + Shift + F10 -> Move the live debugging point

Again this is a very key shortcut which comes handy when we are debugging our code.

This keyboard shortcut helps to move the debug point to a previous location.

Lets check it out with the help of an example.

Lets say I am debugging some code, and my debugger has come to line number 52 but due to some reason I want to go back to line number 42.

We can achieve same by clicking on that specific line and using the key combination ‘Ctrl + Shift + f10’ and debugger will go that line.

The only restriction with this shortcut key is that we can move across in the same scope.

F9 -> Add or remove debug point

This is one of the most useful shortcut key. Instead of going to tool bar or searching in the menu items just use the F9 key to add or remove debug point.

Click on the line of code where you want to keep the debug point and use P9 key.

Shift + F9 -> Quick Watch

While debugging you may want to see the value of a variable or an expression.

The easy way to do that is double click the variable name and press F9 button. You can see a pop up with the variable name and its values.

The same is true for the expressions. You need to select the whole expression and click F9.

The only catch is that you should be debugging the code to use this option.

Below is a code example with screen shot for the same.

If you want to watch the variable while debugging the code, you can click the ‘Add watch’ button on the pop up. This will add the variable to the watch window.

Shift + Alt + P -> Attach a process

Do you want to attach your visual studio code the already running application.

This shortcut comes quite handy and helpful. Once you click the combination you will get a pop up. The pop up contains all the running process in the system.

You may have to select the correct process to attach the code.

Ctrl + Alt + P -> Reattach a process

This key combination can be used to reattach the process. If you have already attached a process, you can attach the same process.

Thus saving the time to find the process.

Shift + F5 -> Stop debugging

If you want to stop the debugging, you can use this key combination.

Conclusion:

These are some of the handy and useful Visual Studio Shortcut keys combinations which I find very helpful while debugging the code.

Do you think or know any other shortcut keys which I am missing here.

Top career enhancing courses you can't miss

My Learning Resource

Excel your system design interview