This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

VS 2010+

Visual Studio 2010 Breakpoint Enhancements

Visual Studio 2010 introduces many enhancements when working with the debugger. Several of these relate to the use of breakpoints, including tagging breakpoints with labels, searching for breakpoints and importing and exporting their details.


All versions of Visual Studio have permitted you to set breakpoints and tracepoints. These are special markers in the source code that, when encountered during debugging, pause the program. You can then interrogate variable values and step through the code line by line from the position of the breakpoint.

The differences between breakpoints and tracepoints and how each is used has been described in a previous article. In this article we will look at three new breakpoint features that were introduced in Visual Studio 2010. These allow you to add labels to breakpoints, search breakpoints using those tags and other details, and export breakpoints to an XML file.

Labelling Breakpoints

Visual Studio 2010 Breakpoints Window

The image above shows an example Breakpoints pane in Visual Studio 2010, displayed by opening the Debug menu, selecting Windows and clicking Breakpoints. In the sample image there are four breakpoints listed. New to Visual Studio 2010 is the Labels column. This shows that each of the breakpoints has been assigned at least one tag. The first breakpoint has two labels, "BUG" and "Business Logic". These labels allow you to categorise breakpoints according to their use or to highlight some items.

You can set the labels for a breakpoint by right-clicking it, either in the Breakpoints pane or where it appears in the code. Select "Edit labels..." from the context-sensitive menu that appears. The Edit breakpoint labels dialog box, pictured below, will be displayed.

Edit Breakpoint Labels Dialog Box

To assign a label to the breakpoint, type the label name into the textbox and click the Add button. All labels that are currently in use are displayed in the list, with the ones assigned to the current breakpoint checked. You can quickly apply multiple categories by checking additional items. To complete the process, click OK. The new labels will be displayed in the Breakpoints pane.

Searching BreakPoints

The Breakpoints pane includes a new search box. This can help you quickly locate breakpoints when you have a large number defined. Simple enter a search term into the box and press Enter to filter the list. Previous searches can be selected using the drop-down element of the search box and you can clear the filters by searching with an empty selection.

The search looks at the information in all columns, including the breakpoint's file location and any labels that have been applied. If you wish to narrow the search to a single column of the table, perhaps to search in the labels only, use the "In Column" drop down list to select the column.

Exporting Breakpoints

The third new feature we will consider is especially useful when several developers work on the same piece of code. In some situations you may wish to share your breakpoints with your colleagues. In other circumstances it would be useful to have only your own breakpoints visible. Visual Studio 2010 allows you to do this by providing the capability to export a group of breakpoints to an XML file. These can then be reimported at a later time or on another computer.

To export all of the currently listed breakpoints, click the export breakpoints toolbar button in the Breakpoints pane. This appears as a breakpoint symbol with a floppy disk icon overlaid. When clicked, you are asked for a location and name for the breakpoints file. You can import the breakpoints at a later time using the import breakpoint button on the toolbar.

17 August 2010