Skip to main content
x

Debugging Keyboard Shortcuts

 

For this subject we need to clarify what a breakpoint is. A breakpoint is a useful tool to find out what is not working in your code. If you encounter the common problem (for most of the programmers) that your code is not working or that it crashes, by using breakpoints you will be able to easier see what step and which line of code is causing the problem.

  1. Did you know that by pressing CTRL + F5 you execute your code in C# much faster? If you only press the “play” button or F5 alone, you execute the program in debug mode, which is only if you want to detect specific bugs. CTRL + F5 runs your code only, without starting the debugger.

  2. Did you know you can insert a breakpoint  just by pressing F9? The cursor has to be on the line you want to insert the breakpoint on. Pressing F9 again will remove the breakpoint.

  3. Did you know that by pressing F10 when executing your code (only if you have set up your breakpoints) you step over the method? You may only want to see the outcome of the method, in which case using F10 will be your best shot. If you hover your mouse over a variable, you will be able to see the result that is stored in that variable at that particular moment during run-time. For more information about debugging, take a look at this video, provided by the Visual Studio Team: https://www.youtube.com/watch?v=ZDnbBah_LRk

  4. Since the execution of a program only goes forward, did you know that if you press CTRL + SHIFT + F5 you restart your code back again? This is instead of stopping your code and restarting it.

  5. However, you might find out that your method has some mistakes, so did you know you can step into your method when pressing F11? This will save you some time when trying to catch the error in your code. A friend of mine showed this actually and it’s been a great help, believe me.

  6. While executing your code, did you know you can write code to fix it in the moment and then press F10 to continue the program? This, however, has to be before you reach the new line you’ve just written, so the compiler will read it.


For more information on debugger shortcut keys, go to: https://msdn.microsoft.com/en-us/library/aa239052(v=vs.60).aspx