Visual Studio – Conditional breakpoints and IntelliSense

I was a bit puzzled to find out how many people overlook the conditional breakpoints in Visual Studio. They usually settle with just setting a regular breakpoint, and then F5-ing their way until the program enters a specific state they are after. Sure, it gets the job done, but it makes your debugging experience worse, and since Visual Studio has so many tools that you can use when debugging, you have no excuse for having a miserable debugging experience (except when you debug distributed systems, then you just suffer :) – well, not really, I am stretching it a bit)

However, this is how you set a conditional breakpoint:

  • add a breakpoint as you usually do
  • then right click the breakpoint indicator and select Condition
  • Voila!
Visual Studio Conditional Breakpoint

Visual Studio Conditional Breakpoint

  • Most of the few people who reach this point will stop here, having the same question in their mind, why no intellisense?
  • The answer: Ctrl + Space, if you press the magic key combination when you type your condition, you will bring up intellisense
  • Voila!
Visual Studio - Intellisense in conditional breakpoint

Visual Studio – Intellisense in conditional breakpoint

  • These features have been in place since forever, however people seem to have overlooked them, even though they greatly improve the debugging experience

One comment on “Visual Studio – Conditional breakpoints and IntelliSense

  1. Carsten Hess March 28, 2014 17:39

    Oh yes… And a cool thing you can do with breakpoints is that you can also set a filter – e.g. to only break when we are on a certain thread (filter on ThreadId). If you ever tried to follow the flow in a method which is called by multiple threads you will appreciate it.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>