Is it possible to specify a breakpoint in Visual Studio 2010 that hits only if the calling methods up the call stack meet some specific condition? For example, and most likely, method name.
I am ideally looking for a solution in Visual Studio itself such as the conditional breakpoint, but I'll settle for testing method names up the stack in code and having a coded breakpoint.
What I'm trying to achieve is to cut out calls from a specific caller.
Conditional breakpoints allow you to break inside a code block when a defined expression evaluates to true. Conditional breakpoints highlight as orange instead of blue. Add a conditional breakpoint by right clicking a line number, selecting Add Conditional Breakpoint , and entering an expression.
To set a conditional breakpoint, activate the context menu in the source pane, on the line where you want the breakpoint, and select “Add Conditional Breakpoint”. You'll then see a textbox where you can enter the expression. Press Return to finish.
Conditional Breakpoints in WinDbg In WinDbg, you can create a conditional breakpoint by clicking Breakpoints from the Edit menu, entering a new breakpoint address into the Command box, and entering a condition into the Condition box.
Right-click the breakpoint symbol and select Conditions (or press Alt + F9, C). Or hover over the breakpoint symbol, select the Settings icon, and then select Conditions in the Breakpoint Settings window.
Right click the breakpoint, choose "Condition" and use something like this:
new System.Diagnostics.StackTrace().ToString().Contains("YourMethodName")
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