Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breakpoints not getting hit while debugging in VS10

I am working on a C# and Silverlight project and every once in a while I run into an issue where my breakpoints are no longer getting hit when I debug. In the editor they are not turning transparent so I know the correct code is loaded and being run.

An example would be:

I have Value with a getter and setter and it is bound to a control. When I put a breakpoint in the setter and I change the value of Value from the control the breakpoint is not getting hit.

I know that an IIS reset fixes this problem but I would like to know the cause. Does anybody else find similar behavior? If anybody would be able to point me in the direction of a possible cause that would be much appreciated.

like image 428
J Lundberg Avatar asked Aug 19 '11 14:08

J Lundberg


1 Answers

There is an option in Visual Studio 2010:

  • Tools -> Options...
  • Debugging -> General
  • "Step over properties and operators (Managed only)"

Make sure this isn't checked. This assumes that the breakpoint is a solid red circle, indicating that VS has found debugging symbols for it.

Alternatively, these elements of code could be decorated with one of various debugging attributes, namely DebuggerStepThroughAttribute, DebuggerNonUserCodeAttribute and DebuggerHiddenAttribute. These may stop the debugger from going into the method, even if a breakpoint is there.

Of course, if the code you are debugging has been optimised, it may look like it's missing lines. I'm not sure what happens if you try to breakpoint a line that has been optimised away.

If the breakpoint has gone hollow (not solid red), then Visual Studio likely cannot find the debugging symbols for the code.

If a reset fixes the issue, perhaps there are differences between the code being debugged and the original source file / symbols, there is an option to make this less strict:

  • Same options area as above.
  • "Require source files to exactly match the original version"
like image 157
Adam Houldsworth Avatar answered Sep 28 '22 23:09

Adam Houldsworth