Bug Report T628519
Visible to All Users

Refactorings - The "Convert to string interpolation" refactoring is not working in specific expressions

created 7 years ago

On the code line

C#
var sw = new StreamWriter(Path.Combine(Application.StartupPath, "PE Error " + DateTime.Now.ToString("yyyy_MM_dd HH_mm_ss") + ".log"));

CodeRush suggests a conversion to string interpolation but does not provide a preview in the light bulb. Also the refactoring is not executed. I tried several time. Sometimes I got the yellow band with the error "'UseStringFormatProvoder' encountered an error and has been disabled". See attached image.

The expected output of the string expression is "PE Error 2018_04_22 19_20_09.log" with the current date time.

Comments (1)
DevExpress Support Team 7 years ago

    Hi Olivier,

    Thank you for letting us know about this problem.

    I reproduced this behavior locally. You will be notified when we prepare a fix.

    Answers approved by DevExpress Support

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

      Comments (2)
      O O
      Olivier Jacot-Descombes 7 years ago

        I have CodeRush 17.2.8 and the problem seems not to be resolved yet. I'm a bit confused about which version contains the fix. The box "Fixed" on this page says 17.2.8 and the box "Fixed in" says 17.2.9.

        More info: I am using C# latest minor version (i.e. 7.2). The project showing the error uses .NET Framework 3.5.

        The refactoring "Convert to string interpolation" does not work (i.e. does not show a preview and has no effect).
        The refactoring "Use string.Format" produces an exception.

        DevExpress Support Team 7 years ago

          Hello Olivier,
          The "Fixed in" 17.2.9 box means that the fix for this issue will be included in the next 17.2.9 update. But you can Request a hotfix at any time. We have just published it and you are welcome to download and try it.

          Also, here is a link to the build with the fix here:
          DevExpress.CodeRush.Roslyn-17.2.8.18116.vsix

          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.