
Troubleshoot Breakpoints #37
Chapter 5, Debugging
|
149
HACK
default is to break always. You can, however, specify it to break when the hit
count equals, is a multiple of, or is greater than or equal to a specified value,
as shown in Figure 5-9.
With this setting, the breakpoint won’t cause the program to enter break
mode until it has been reached five times. The hit count technique is espe-
cially useful when you want to place a breakpoint within a loop, but are
interested in breaking only in specific cycles of the loop. For example, if you
wanted to break only after the loop had iterated a dozen times, you could set
the breakpoint to break only when its hit count was greater than or equal to
12. You could also configure the debugger to stop on each tenth iteration of
the loop by configuring the breakpoint to break only when its hit count is a
multiple of 10.
A large part of the life cycle of a computer program is testing and debug-
ging. Visual Studio’s powerful debugger enables developers to rapidly debug
applications. One of the most common tools used in debugging are break-
points. Breakpoints in Visual Studio can be added to specific lines of code or
particular functions and can be given conditions on when to break and how
often, based on a hit count.
—Scott Mitchell
HACK
#37
Troubleshoot Breakpoints Hack #37
Use an online web application to figure out why your breakpoints aren’t
working.
In “Set