Udostępnij za pośrednictwem


How to: Specify a Hit Count

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic applies Topic does not apply

Standard

Topic applies

Topic applies

Topic applies

Topic applies

Pro and Team

Topic applies

Topic applies

Topic applies

Topic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

Hit count keeps track of how many times a breakpoint is hit.

By default, execution breaks every time a breakpoint is hit. You can choose to:

  • Break always (the default).

  • Break when the hit count equals a specified value.

  • Break when the hit count equals a multiple of a specified value.

  • Break when the hit count is greater or equal to a specified value.

If you want to keep track of the number of times a breakpoint is hit but never break execution, you can set the hit count to a very high value so that the breakpoint is never hit.

The specified hit count is retained only for the debugging session. When the debugging session ends, the hit count is reset to zero.

To specify a hit count

  1. In the Breakpoints window, right-click on a breakpoint and choose Hit Count from the shortcut menu

    —or—

    In a source, Disassembly, or Call Stack window, right-click on a line containing a breakpoint and choose Hit Count from the Breakpoints submenu in the shortcut menu.

  2. In the Hit Count dialog box, choose the behavior you want from When the breakpoint is hit list box.

  3. If you choose any setting other than break always, an edit box appears next to the list box. Edit the integer that appears in the edit box to set the hit count you want.

  4. Click OK.

See Also

Tasks

How to: Specify a Breakpoint Condition

Concepts

Breakpoints and Tracepoints