Conditional Breakpoints in Visual Studio

Conditional break points can be quite handy and indispensable if you are debugging a code that is looping though a large no of iterations. It is tedious to loop though every iteration to find the problem case. A awesome way to trouble shoot this, is to use Conditional breakpoints!

Conditional Breakpoint to match a string

Set a break point and right click on it (left most gray area) and select condition. In this case we are look for a condition when the string for example contains the world 2007. So will write the following condition

mystring.IndexOf("2007") >= 0

# In the same dialog, set true radio button for this condition.

when you execute this code, the break point will be hit whenever the string mystring contains the world “2007”.

This entry was posted in Software Development and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s