Did you know – Code Map can be used to visualize the call stack directly ?

By | December 8, 2015

In Visual Studio, by using the Call Stack window, we can view the function call that are currently on the stack for that instance of execution steps. It’s one of most frequently used feature during debugging.  This helps us to trace the code flow and debug thing faster and   If you are familiar with Code Maps, you must have seen how friendly and powerful it is for visualize representation of your code  inside Visual Studio. We have seen the usages of code map for dependency graph, call references , related items and showing references etc.

With all these nice feature of Code Maps, one thing that you could  also use very frequently is to get the entire call stack  in a code map.  While in debug, when it’s hit the break point,  select “Show Call Stack on Code Map” option from the context menu.

Show Call Stack on Code Map During Debugging

Show Call Stack on Code Map During Debugging

Must Read : 10 Effective Debugging Tips for .NET Developer

This will generate the code map on the fly for the current call Stacks and will be displayed in a side by side way as shown in the screenshot  below.

 Code Map for the Selected Call Stacks

Code Map for the Selected Call Stacks

Here instead of traditional calling statement, you will get a nice visual way of representation.  Now you use it in same way like you do for traditional call stack windows.

Check this out : Debugging Lambda Expression in Visual Studio 2015 – Watch Windows, Immediate Windows and also in DataTips

Call Stack in Code Map and Call Stack Window Side by Side

Call Stack in Code Map and Call Stack Window Side by Side

Following screenshot shows a side by side view of Call Stack in Code Map and Call Stack Window.

Not only from a debug breakpoint, you can invoke the call stack in code map even if there is an exception. In a short, you can use this feature as similar to a call stack, only the difference with visual representations.

Hope this helps !

2 thoughts on “Did you know – Code Map can be used to visualize the call stack directly ?

  1. Pingback: Dew Drop – December 9, 2015 (#2148) | Morning Dew

  2. Pingback: Szumma #020 – 2015 50. hét | d/fuel

Comments are closed.