Breaking the Nth time a line gets executed
-
28-10-2019 - |
Question
Is there a way to tell the Visual Studio debugger, "break at this line the Nth time it gets executed, not before" (where N is an integer greater than 1)?
(Just for information, I'm using the C# programming language.)
Solution
See this MSDN article - How to: Specify a Hit Count.
In short - in the breakpoints window you right click the breakpoint and select Hit Count
.
OTHER TIPS
You also may try setting up a counter variable and then use a conditional break point and call:
System.Diagnostics.Debugger.Break();
under a condition.
Yes, if you add a conditional breakpoint and use the breakpoint hit count option.
http://msdn.microsoft.com/en-us/library/aa290719(v=vs.71).aspx
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow