Quick Tip: How to move a breakpoint in the Visual Studio debugger

Setting a breakpoint in the Visual Studio debugger is as simple as placing your cursor on a line of code and pressing F9. However, once you've set the breakpoint, how do you move it to a different location since clicking on the breakpoint will delete it? One workaround is to delete the breakpoint and set a new breakpoint at the new location. The problem is, if you have set a bunch of options on the breakpoint, e.g. a condition, then those options will get lost in the move.

The trick to moving a breakpoint is to use the Breakpoint Location option to change the line number of the breakpoint. You can access the Location option by right-clicking on the breakpoint the you want to move and selecting "Location...", as shown below.

Breakpoint Location

On the File Breakpoint dialog, simply change the Line field to the new location and press [OK]. The breakpoint will move to the new location.

File Breakpoint dialog

Habib Heydarian.