Bug Report T371840
Visible to All Users

The "Declare Constant" refactoring does not replace all occurrences in a file

created 9 years ago

I cannot recall fully, but i believe in Coderush classic, Declare constant refactoring will replace all instances of a particular string in the file when applied.

But in Coderush Roslyn, only the particular instance on which the refactoring was applied changes.

C#
{"Start Date", startDate.ToString("yyyyMMdd")}, {"End Date", endDate.ToString("yyyyMMdd")},

If i apply the refactoring by selecting the string for startDate, the endDate remains the same. I think Coderush classic used to replace all the occurences but dont have it installed anymore to check.

Comments (3)
DevExpress Support Team 9 years ago

    Hi Senthil,

    You are absolutely right, CodeRush Classic replaces all occurrences in the file when you apply the "Declare Constant" refactoring.
    We will add this behavior to CodeRush for Roslyn and notify you as soon as it is implemented.

    SR SR
    Senthil Ramanathan 9 years ago

      Thanks. BTW, the behaviour is similar with the "Name can be simplifed" refactoring for types/namespaces too. Only the specific occurrence is replaced.

      Models.ReportModel pReport = new Models.ReportModel();

      The refactoring replaces the "Models." only on the LHS while the RHS is left as is.

      DevExpress Support Team 9 years ago

        Hello,

        I've created a separate ticket on your behalf (The "Name can be simplified" refactoring replaces only a specific occurrence). It has been placed in our processing queue and will be answered shortly.

        Answers approved by DevExpress Support

        created 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.