If I set a breakpoint on a method, how can I see what called the method, when the breakpoint is hit in Visual Studio 2008?
View the call stack while in the debugger While debugging, in the Debug menu, select Windows > Call Stack or press ctrl + alt + C .
To display the call stack window you must first start your code in debug mode. Either start your application using the Step Into command or use a breakpoint to halt execution. You can then show the window by opening the "Debug" menu, expanding its "Windows" submenu and selecting "Call Stack".
To display the Call Hierarchy window, right-click in the code editor on the name of a method, property, or constructor call, and then select View Call Hierarchy.
Check the Call Stack window (from the menu: Debug > Windows > Call Stack). Double clicking each entry there will take you to the calling statement. You can also right click on it to enable/disable showing external code items and calls from other threads.
When the breakpoint is hit, you can view the entire call stack. You can bring that window up by going through the Debug menu->Windows->Call Stack.
You can also bring it up by the shortcut Alt+Ctrl+C
EDIT: You can also right-click on a function name, and view the "Callers Graph", which will show you all the callers for your method. Alternatively, you can bring the Call Browser (by going to View->Other windows->Call Browser ) and search for your method's name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With