Apparently VS 2008 does not allow setting a breakpoint just on the setter of an auto-property.
I.e. if I define an auto-property like this:
public int CurrentFramesize { get; protected set; }
and then try to set a breakpoint on the setter line, the whole auto-property turns breakpoint-red.
This works just fine for normal properties, so any idea why auto-properties get this special (restrictive) treatment? Are they more than just syntactic sugar to normal properties with a hidden backing field?
If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.
Set breakpoints in source code To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
Breakpoints can be toggled by clicking on the editor margin or using F9 on the current line. Finer breakpoint control (enable/disable/reapply) can be done in the Run and Debug view's BREAKPOINTS section.
Using Visual Studio 2008, 2010, 2012:
For the get, type: ClassName.get_CurrentFramesize()
For the set, type: ClassName.set_CurrentFramesize(int)
You'll get a "No Source Available" when the breakpoint is hit, but you'll get the calling location in the call stack.
I found this solution here: http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/b1dd0dc3-e9c1-402a-9c79-a5abf7f7286a
See also: Debugging automatic properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With