Bug Report T919754
Visible to All Users

Refactoring - The “Use String.Format” refactoring is not available for the code that contains a variable’s value or the result of an expression

created 5 years ago

Hello,

One of the options I reguarly use with coderush is pressing control + ~ and selecting 'use string.format' option.
This used to look like this:

Clipboard-File-1.png

But now when I press control + ~ I get this:
Clipboard-File-2.png

It is probably some setting somewhere, but I cannot find it. Please assist.

Thank you.

Comments (3)
PW PW
Przemyslaw Wlodarczak (DevExpress) 5 years ago

    Hi,

    Please check to see that the refactoring is enabled in the options. Open the CodeRush->Options… tool window, navigate to the "Editor->Visual Basic->Code Actions->Code Actions Catalog" page and make sure that the "Use String.Format" refactoring is enabled.
    UseStringFormatOptions.png

    If this does not help, post here sample code where the refactoring is not available for you. It is not clear from your second picture how the code looks.
    I tried the code similar to your first example and I can execute "Convert to String.Format" in such case:
    UseStringFormat.png

    I am looking forward to hearing from you.

    P P
    P.J. Bollebakker 5 years ago

      Hi,

      String.Format is enabled.
      Clipboard-File-1.png

      Made a couple tests and it seems it does work in some situations.

      Working:

      Visual Basic
      Dim result = "Total: " & 10
      Visual Basic
      Dim result = "Total: " + 10.ToString()

      Not working:

      Visual Basic
      Dim a As String = "a" Dim b As String = "b" Dim result = a & b
      Visual Basic
      Dim a As String = "a" Dim b As String = "b" Dim result = a + b
      Visual Basic
      Dim str = "total: " Dim result = str + 10.ToString()

      Example screenshot
      Clipboard-File-3.png

      PW PW
      Przemyslaw Wlodarczak (DevExpress) 5 years ago

        Thank you for the code snippets. I reproduced this behavior on my side. We will let you know when we fix this issue.

        Answers approved by DevExpress Support

        created 5 years ago

        We have addressed the issue described in this ticket and will include a fix in our next maintenance update. To apply this solution before official release, request a hotfix by clicking the appropriate version link.

        Note: Hotfixes may be unavailable for betas/updates set for release within a week.

          Show previous comments (2)
          DevExpress Support Team 5 years ago

            We have published the requested patched build and are looking forward to hearing about your results. Meanwhile, we would like to mark this ticket as Public, if you do not mind, to include it in the What's New lists for future maintenance updates.

            P P
            P.J. Bollebakker 5 years ago

              Thank you very much.

              Making it public is fine. No problem!

              AE AE
              Alex Eg (DevExpress) 5 years ago

                You are welcome. Thank you for your cooperation. We marked the ticket as 'Public'.

                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.