Udostępnij za pośrednictwem


How to: Label Breakpoints

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

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

Pro, Premium, and Ultimate

Topic applies

Topic applies

Topic does not apply Topic applies Topic applies

In Visual Studio, you can use labels to help keep track of your breakpoints. A label is a name that you can attach to a breakpoint or a group of breakpoints. You can create a name for a label or you can choose from among a list of existing labels. You can attach multiple labels to each breakpoint.

Labels are useful when you want to mark a group of breakpoints that are related in some way. After you have labeled the breakpoints, you can use the search function in the Breakpoints window to find all breakpoints that have a specified label.

The search function searches all columns of information that are visible in the Breakpoints window. To make your labels easy to search for, avoid using label names that might conflict with strings that appear in another column. For example, if you have a source file that is named "Program.cs", "Program.cs" will appear in the name of any breakpoint set in that file. If you use "Prog" as a label name, all breakpoints set in Program.cs will appear when you search for breakpoints labeled "Prog".

To label breakpoints

  1. In the Breakpoints window, select one or more breakpoints.

    To select multiple breakpoints, press CTRL+click.

  2. Right-click the selected breakpoints, and then click Edit labels.

    The Edit breakpoint labels dialog box appears.

  3. Select one or more labels in the Choose among existing labels box.

    –or–

    Type a new label name in the Type a new label box, and then click Add.

To search for breakpoints that have a specified label

  1. In the Breakpoints window toolbar, click the In Column box and select Labels from the drop-down list.

  2. In the Search box, type the name of the label you want to search for and press ENTER.

To remove labels from breakpoints

  1. In the Breakpoints window, select one or more breakpoints.

    Press CTRL+click to select multiple breakpoints.

  2. Right-click the selected breakpoints, and then click Edit labels.

    The Edit breakpoint labels dialog box appears.

  3. In the Choose among existing labels box, clear the checkboxes for labels that you want to remove from the selected breakpoints.

To sort the breakpoint list by label

  1. In the Breakpoints window, right-click the breakpoint list.

  2. Point to Sort by and then click Label.

  3. (Optional) To change the sort order, right-click the breakpoint list again, point to Sort by, and then click Sort Ascending or Sort Descending.

Editing Breakpoint Labels from a Source Window

You can access the Edit breakpoint labels dialog box from a source code window. This enables you to add or remove labels without opening the Breakpoints window.

To add or edit breakpoint labels from a source window

  1. In a source window, right-click a breakpoint, and then click Edit labels.

    The Edit breakpoint labels dialog box appears.

  2. Add or remove labels, as described in the procedures earlier in this topic.

See Also

Tasks

How to: Use the Breakpoints Window

Concepts

Using Breakpoints and Tracepoints