Click here to Skip to main content
14,326,008 members

Visual Studio Tips - Breakpoints

Rate this:
4.52 (7 votes)
Please Sign up or sign in to vote.
4.52 (7 votes)
28 Mar 2019CPOL
Few under-utilized features of breakpoints in Visual Studio that you should be aware of

Most of us know about Breakpoints and how to use them, but there are a few under-utilized features of breakpoints that you should be aware of.

You can set a simple breakpoint in a number of ways:

  1. Move the cursor to the line you want to break on and hit the F9 key
  2. Right click on the line of code
  3. Clicking in the gutter

Once you have a breakpoint set, you can do a few things with it. First, you can disable it, if you don’t need the breakpoint right now, but think you might come back to it.

Image 1

You can also disable all breakpoints from Debug -> Disable all breakpoint. This is handy for when you need to run and get reset, then re-enable all breakpoints and start your debugging again.

You can also make the breakpoint conditional based on the value of a variable or any boolean expression (yes, you can use the No Side Effects formatter). This can be helpful if you want to break when the value of a variable is a certain value.

Image 2

You can also make the breakpoint conditional based on the number of times a breakpoint is hit. For example, you might know that the first time a breakpoint is hit isn’t interesting to your debugging scenario but every time after that is interesting. You could set hit count > 1.

Image 3

You can also filter your breakpoints to a single thread or to exclude a thread, either by name or id.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jeremy Hutchinson
Software Developer
United States United States
I’m a Senior Engineer at Quicken Loans and a Microsoft Azure MVP. I’ve has been developing line of business applications for 15 years primarily in the Microsoft Stack, and have a passion for writing clean, scalable code and sharing what I’ve learned with others.

I also help run the Casco Bay .Net User Group

Comments and Discussions

GeneralMy vote of 4 Pin
RojoEl1-Apr-19 11:39
memberRojoEl1-Apr-19 11:39 
GeneralRe: My vote of 4 Pin
Jeremy Hutchinson13-Apr-19 8:59
professionalJeremy Hutchinson13-Apr-19 8:59 
PraiseRe: My vote of 4 Pin
RojoEl14-Apr-19 14:21
memberRojoEl14-Apr-19 14:21 
QuestionA good introduction... Pin
charlieg29-Mar-19 2:18
membercharlieg29-Mar-19 2:18 
AnswerRe: A good introduction... Pin
Jeremy Hutchinson13-Apr-19 8:51
professionalJeremy Hutchinson13-Apr-19 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 28 Mar 2019

Tagged as


2 bookmarked