Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / C#
Tip/Trick

Stepping in a Specific Method while Debugging Your Code

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
22 Jun 2012CPOL1 min read 10.7K   1   2
A time-saving tip when you have to step in and out from line of code calling multiple methods
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.

C#
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

License

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


Written By
Architect
Canada Canada
Kamran Bilgrami is a seasoned software developer with background in designing mission critical applications for carrier grade telecom networks. More recently he is involved in design & development of real-time biometric based security solutions. His areas of interest include .NET, software security, mathematical modeling and patterns.

He blogs regularly at http://WindowsDebugging.Wordpress.com

Comments and Discussions

 
GeneralMy vote of 5 Pin
johannesnestler26-Jun-12 2:00
johannesnestler26-Jun-12 2:00 
GeneralThoughts Pin
PIEBALDconsult22-Jun-12 5:16
mvePIEBALDconsult22-Jun-12 5:16 

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.