Aside

Visual Studio Debugger Tips and Tricks: Run to Cursor

Run to Cursor

Imagine, you are in the debugging mode and the next statement is a loop. You do not want to step into this loop and waste time on iterating over items but you also do not want to step out of the method. What you can do is to place cursor in the line you would like the debugger to break and select Run To Cursor option from context menu (shortcut: Ctrl + F10). It is an easy way to jump through the code, breaking in chosen places to peek on variable values.

You can even use Run To Cursor for starting an application and breaking in selected line.

Find other Visual Studio Debugger Tips’n’Tricks: https://mariuszwojcik.wordpress.com/category/visual-studio/debugging/

Advertisements
Aside

Visual Studio Debugger Tips and Tricks: step into specific

Step into specific

We all try to keep our code concise, so from time to time there is one line which calls several methods, like this one:

PrintMessage(FormatResult(text, ReverseString(text)));

When debugging your code and you want to step into one of the “outer” methods, either FormatResult or PrintMessage in the above example, then right click in the code window and select Step Into Specific option. The Visual Studio will show you list of all methods you can step into. Just click the one you want to debug and debugger will break there.

Find other Visual Studio Debugger Tips’n’Tricks: https://mariuszwojcik.wordpress.com/category/visual-studio/debugging/

Aside

Visual Studio Debugger Tips and Tricks: step out

Visual Studio excerpt

How many times did you step into a method just to realise you didn’t want to? Sometimes it is a simple, short method and you can step through it. Other times it is one of those monstrosities spanning for dozens of lines, or a recursive function. Instead of stopping debugger and starting again to avoid the mistake you can actually step out from the method. Just click step out icon on the toolbar, or use Shift + F11 shortcut and the debugger will take you out.

Find other Visual Studio Debugger Tips’n’Tricks: https://mariuszwojcik.wordpress.com/category/visual-studio/debugging/