none
Setting a breakpoint on a C# property written in the short hand syntax

    Question

  • When I am debugging code which has a property written in the short hand format-

    public int MyProperty {get; set;}

    I cannot set a breakpoint on the line, or anywhere inside it.
    I know I can temporarily rewrite the line in the standard format, but isn't there an easier way?

    Is there a hot fix abvailable for VS 2008? Is it fixed in VS 2010?

    Thanks,
    Richard

     

    Tuesday, April 27, 2010 1:12 AM

Answers

  • Hi Richard,

    Thanks for reporting this issue.

    Currently, there is no support to break into property short hand getter and setter. If you really want it to be include in the next version of Visual Studio, you can submit a feature request at http://connect.microsoft.com site. Thanks.

    Another workaround instead of rewriting the property is to set the breakpoint by function name. Please open the Breakpoints window from Debug / Windows / Breakpoints menu. Click New / Break at Function. In the Function field, fill <Full Type Name>.set|get_<Property Name>. For example: MyNamespace.MyType.get_MyProperty.

    Hope it helps.


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    Tuesday, April 27, 2010 7:23 AM

All replies

  • Hi Richard,

    Thanks for reporting this issue.

    Currently, there is no support to break into property short hand getter and setter. If you really want it to be include in the next version of Visual Studio, you can submit a feature request at http://connect.microsoft.com site. Thanks.

    Another workaround instead of rewriting the property is to set the breakpoint by function name. Please open the Breakpoints window from Debug / Windows / Breakpoints menu. Click New / Break at Function. In the Function field, fill <Full Type Name>.set|get_<Property Name>. For example: MyNamespace.MyType.get_MyProperty.

    Hope it helps.


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    Tuesday, April 27, 2010 7:23 AM
  • Truely helpful..Thanks
    Monday, November 12, 2012 7:11 AM