In this tip, you will learn how to save time when you have to step in and out from a line of code calling multiple methods.
Introduction
Let's say you are debugging the following line of code and you want to step into ProcessList
method itself.
ProcessList(GetListOfStrings(), GetListOfInts());
Typically, you will hit F11 (or Step Into option). That action will first take you in GetListOfStrings
method. Since you do not want to debug this particular method, you will simply step out of here. Then, you hit F11 again which will take you in GetListOfInts
method. Again, you really want to debug ProcessList
method so once again, you will step out from here as well. Now if you hit F11 again, this time it will take you in the right method ProcessList
and you can debug the piece of code that you wanted to debug.
Rather than hitting F11 three times and stepping out of these methods, you can right click when the first time you hit line of code where ProcessList
method is called. If you look at available options in this context menu, one option is called "Step Into Specific". This option will also have sub-menus with all possible methods that could be invoked from this particular line. As show in the figure below, all three methods, ProcessList
, GetListOfStrings
and GetListOfInts
are available here. If you choose ProcessList
from this context sub-menu, it will take you directly in ProcessList
method without stepping in and out of other two methods.
I hope you find this tip helpful.
History
- 22nd June, 2012: Initial version