Archive for conditional breakpoints

Visual Studio Conditional Breakpoints Pitfalls

Posted in csharp, Visual Studio with tags , on September 8, 2012 by vlipwig

Conditional Breakpoints in Visual Studio are great. They allow you to restrict when the breakpoint will hit based on the evaluation of a Boolean expression. You can choose to hit the breakpoint when the condition is true or when the result of the condition has changed.
But there are a couple of things you should be aware of:

  • that the source language determines the expression operators. This means that if you are debugging in Visual Basic, the “<>” operator means “not equal” while in C# or C++/CLI, you would use “!=”.
  • if you choose a wrong expression operator you get no warning or error. Assume you use “=” (assign) instead of “==” (equal) and you will see that suddenly the variable you are examine will always have the same value.

So do yourself a favor and double check the conditions of your breakpoints.

More infos about conditional Breakpoints:

http://msdn.microsoft.com/en-us/library/7sye83ce.aspx

http://support.microsoft.com/kb/308469