Bug Report T337955
Visible to All Users

SmartConstructor should not get reserved keywords as a parameter name

created 9 years ago

[DevExpress Support Team: CLONED FROM T294233: Smart Constructor - Add an ability to initialize properties]
Hi Eugene,
I found one more issue with this feature that you might want to address.
If there is a property on the type, whose lower-case representation conflicts with a language keyword, the refactoring produces syntactically incorrect code.
For example, if you have a property "Default" on your class, and use the "cc" template, the resulting constructor parameter is named "default" which is a reserved keyword. This results in an immediate compiler error.
This refactoring should prefix such parameter names with @, i.e. "@default".

Show previous comments (1)
DevExpress Support Team 9 years ago

    Hi Daniel,
    We've released the new version of CodeRush for Roslyn, which contains a fix for this problem.
    Working on the solution, we added the new Naming Conventions functionality into the product.
    It allows you to specify name rules for a different code element such as Namespaces, Types, Members, and these rules will be used in refactorings, declarations and templates automatically.

    DR DR
    Daniel Rosenberg 9 years ago

      Indeed it works fine now - thanks!
      And the new Naming Conventions feature is definitely a big step forward!

      DevExpress Support Team 9 years ago

        Hi Daniel,
        You are welcome.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 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.