I suggest you ...

Setting breakpoints on auto-implemented 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.

137 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    MattMatt shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    jancsi03jancsi03 shared a merged idea: Allow debugger break into property short hand getter and setter  ·   · 
    completed  ·  Visual Studio TeamAdminVisual Studio Team (Product Team, Microsoft) responded  · 

    Hi,

    You can now do this with Visual Studio 2015 Preview http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs

    Please see our blog post for more details: http://blogs.msdn.com/b/visualstudioalm/archive/2014/11/14/set-breakpoints-on-auto-implemented-properties-with-visual-studio-2015.aspx

    If you have any feedback or questions for us, please, reach out through:
    Send-a-Smile (Visual Studio feedback tool)
    https://twitter.com/VS_Debugger
    vsdbgfb@microsoft.com
    commenting on our blog post – http://blogs.msdn.com/b/visualstudioalm/archive/tags/diagnostics/

    If you would like to follow news about the Visual Studio Debugger, please subscribe to our blog or to our twitter account.

    Thanks for sharing this suggestion with us and for using Visual Studio!
    Maria Ghiondea
    Visual Studio Diagnostics

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base