
VS 2005+Breakpoints and Tracepoints in Visual Studio (2)
When debugging program code it is important to be able to pause the code at a specific location. Using Visual Studio breakpoints and tracepoints, the code can be halted at a desired line or can output trace information when conditions are met.
Removing a Breakpoint
If you no longer require a breakpoint, it can be removed using the same actions used to create it. You can select the marked line of code and choose the "Toggle Breakpoint" command or press F9. Alternatively, simply click the breakpoint glyph. When you successfully remove a breakpoint the glyph disappears.
When debugging large programs it is common to set many breakpoints, possibly in several different files. Once the debugging operation is complete, you can remove all of the breakpoints in a project by selecting the "Delete All Breakpoints" option from the Debug menu.
Disabling Breakpoints
Sometimes you will want to prevent a breakpoint from halting execution without deleting it completely. You can disable all of the breakpoints in the project by selecting the "Disable All Breakpoints" command from the Debug menu. To disable a single breakpoint, right-click its glyph and choose "Disable Breakpoint" from the context-sensitive menu that appears. A disabled breakpoint's glyph is shown without shading, as in the image below:

File Breakpoint Dialog
In addition to the simple breakpoints that can be created using the above methods, Visual Studio allows fine control over the break action using a series of advanced settings. The first set of these is accessed using the File Breakpoint dialog box. To view these settings, right-click an active breakpoint and choose "Location..." from the context-sensitive menu.

The File Breakpoint dialog box provides more control over the position of a breakpoint using three settings. Firstly, the filename of the code file in which to place the breakpoint can be specified. The line number and character position can also be provided. This allows a breakpoint to skip the first statement if you have placed more than one command on a single line.
Usually when debugging in break mode, the source code file must perfectly match the file that was used when the program was compiled. Sometimes you will have made minor modifications to the code but will still want the breakpoint to be used. In these situations you can place a tick in the checkbox to "Allow the source code to be different from the original version".
20 August 2008