views:

159

answers:

2

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?

A: 

No you can't set a break point on them, but then what would you check? The variable for storage of the auto-property is only assigned at runtime and as such there isn't a variable for the debugger to show/access.

ChrisBD
You might want to check *when* it's assigned, if it seems to get a wrong value from "somewhere".
Hans Kesting
@Hans Kesting: Spot on. The CLR debugger doesn't have *data* breakpoints, so if this would be supported, it would be the next best thing.
Cristi Diaconescu
+1  A: 

The short answer is: this bug feature ended up on the cutting room floor for VS2008.

(Longer answer - hat tip @jdk)

All we've got is a vague promise that it's being considered for vNext.

Cristi Diaconescu