Bug Report T699511
Visible to All Users

Code Cleanup - The "Use expression bodies" cleanup rule makes expression-bodied properties read-only

created 6 years ago

Since installing 18.2.4 the Use Expression Bodies code cleanup has been formating passthrough properties to be read only properties.

For a property that allows toggling of sorting of a view I have the following property:

public bool AllowSorting
        {
            get => m_View.OptionsCustomization.AllowSort;
            set => m_View.OptionsCustomization.AllowSort = value;
        }

When cleanup is run, it is getting changed to:

public bool AllowSorting => m_View.OptionsCustomization.AllowSort;

this makes the property read only and creates compiler errors:

The only solution I have found is tio disable the cleanup.

Comments (1)
DevExpress Support Team 6 years ago

    Ben,

    I have reproduced this issue. Please give us some time to correct it.

    It occurs if you have the "Use expression bodies" cleanup rule enabled.
    So, as a workaround, disable this rule.
    This way you can keep the code cleanup feature enabled.

    Follow these steps to get to the Code Cleanup options page:

    1. From the Visual Studio menu, select "CodeRush\Options…" .
    2. In the tree view on the left, navigate to this folder:
                  Editor\C#
    3. Select the "Code Cleanup" options page.
    4. Find the "Use expression bodies" rule and disable it.

    Answers approved by DevExpress Support

    created 6 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.