allow breakpoints to be set on no-body properties.
Often times I am motivated to create properties that have no custom accessor or specifier bodies. For example:
class Person
{
private int _age { get; set; }
}
The advantage of a property over field in this case is that if I ever want to debug how and when _age is being mutated or accessed I can fill in the bodies of get and set with an obligatory backing field:
class Person
{
private int _ageBacking;
private int _age { get { return _ageBacking; } set { _ageBacking = value; }
}
and set breakpoints in the get and set body. Let's bypass the need for the backing field and allow users to set breakpoints on the original property. Even if we can't do any "hovering over" to see the value of the property it is still useful for the breakpoint to be hit just so we can see the current state of the stack when the code interacts with the property.
3 comments
-
Tobias
commented
The correct name of "no-body-properties" is "auto-implemented properties" and I would really, really, really appreciate the feature of setting breakpoints on auto-implemented properties!
-
Dennis
commented
Why was this question tagged Visual Basic?
-
Matt
commented
As as a side note, if you try this in VS it looks like VS will allow you to set the BP. But when it comes time to actually debug the original position of the BP isn't respected. This is probably a bug.