Call Hierarchy : A handy feature in Visual Studio 2010

Suppose we have a solution that contains different dependent projects. We can face 2 most common situation here:

Situation 1: We have a method that we need to change by modifying the definition of that method or just we want to check that which other methods are calling this method.

Situation 2: We have a method that contains so many lines of codes and we need to check that inside this method which all other methods are calling as method is too large and we don’t want to go line by line for this.

Before VS 2010, for situation 1, we need to search the method name in whole solution then we can find the call of this solution in search window but the drawback of this approach is that if you have overloaded methods then in search result all methods will display and you need to take extra care for that.

Now in VS 2010, Microsoft provided a beautiful menu and context command to help these situations. Below are the steps to use these helpful commands:

  1. First you need to open your solution.
  2. Now open the file, where the method is located and needs to be checked.
  3. Go to View > Call Hierarchy
  4. Call Hierarchy window will open on bottom side, in this window choose My Solution from drop down. (You can also choose Current Project, Current Document depending upon your needs.)
  5. Now right click the method name in file opened and click on “View Call Hierarchy” from context menu.
  6. Your Call Hierarchy window will populate with details like Calls To “Method Name” and Calls From “Method Name” you can just expand these nodes and check all the incoming and outgoing call from this particular method.

Enjoy this new feature 🙂



3 thoughts on “Call Hierarchy : A handy feature in Visual Studio 2010

    1. Avi,
      This is far more advance in comparison of “Find All References”. First thing is that it displays in a separate windows that represents the hierarchy in a better manner. Second thing by using “Find All References”, we can only get the how many functions are calling my function but by using “Call Hierarchy”, you also come to know that from my function call how many other functions are calling. Better is you have a look in to this practically. Hope it helps.

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s