The call stack keeps track of the currently executing method in your application, and from where that method was called. You can use the debugger in Visual Studio to view the current call stack when you are in break mode (at a breakpoint or stepping through your code).
If the call stack is not already visible, click on the Debug menu, then Windows and Call Stack. (Or press Ctrl+D, C).
In the example below, we’ve started the application and are located in our Main method, which was called by native code.
If we now step into the Dog.BarkYourAge method, the call stack shows this method on the top of the stack, with Main as the second entry. Main is just below BarkYourAge in the stack, because it called BarkYourAge.
If BarkYourAge then calls DogUtil.GenerateBark and we step into that method, we see:
If we return from GenerateBark, we see:
Filed under: Visual Studio Tagged: C#, Call Stack, Visual Studio
