Binding Breakpoints in Visual Studio Debugging
Few months back I ran into a strange behavior regarding breakpoints.
Debugging a c# solution in Visual Studio 2008 I’ve noticed the breakpoints I have “click” removed during one debug session reappear as soon as session ends.
After repeated tries, the solution was to CTRL+SHIFT+F9 remove all breakpoints and set them again where needed.
When the situation occurred again debugging a different solution I start googling it and found that what I’ve considered back then a bug it is actually a “feature”.
The Visual Studio Debugging mechanism involves three types of breakpoints:
- pending breakpoint
- bound breakpoint
- error breakpoint
The break point set in the code editor it is a pending breakpoint. When the code executes, the debug engine checks such breakpoints to see if they can be bound to related code contexts and generates bound breakpoints. In design mode the breakpoint window displays hierarchical the pending and bound breakpoints.
In my case, because of the WCF logic involved, execution of code was not yet done when I remove the breakpoint, so what I really removed by simply clicking the editor margin was the bound breakpoint. The pending breakpoint was still set when session ended and will regenerate all bound breakpoints in the next session.
References:
http://msdn.microsoft.com/en-us/library/bb146593.aspx
http://msdn.microsoft.com/en-us/library/bb161312%28VS.80%29.aspx


Tags: 



One Response
October 5, 2010 1
last few days our class held a similar talk about this subject and you illustrate something we have not covered yet, appreciate that.
- Laura
Leave a Reply