Bug Report T464345
Visible to All Users

Code CleanUp should not change the "" literal in the switch case clause

created 8 years ago

Hi

Just doing some clean up and found a possible bug:

I have it set to change double quotes  ("") to string.Empty as I much prefer this for readability etc. However when cleaning up a switch case with this in, it we then get an error on the line:

C#
switch (DataUtils.GetParameterString(m_Command, "@acc_status")) { case "": // Account is currently open CreditAccStatusLabel.Text = Resources.MsgAccountIsOpen; break; case "S": // Account is currently suspended CreditAccStatusLabel.Text = Resources.MsgAccountIsSuspended; break; case "C":

the above is cleaned to become this:

C#
switch (DataUtils.GetParameterString(m_Command, "@acc_status")) { case string.Empty:

as you can see the case "": has been changed to string.Empty.

However VS will now throw an error on this line:

Error CS0150 - A constant value is expected

Hope this helps to clear this up.

Cheers

Comments (3)
DevExpress Support Team 8 years ago

    Hello Alan,

    Thank you for pointing out this issue and providing a code sample.
    I have reproduced this, and we agree that Code CleanUp should not replace the "" literal in switch case clause.

    We will notify you as soon as we fix this issue.

    AM AM
    Alan Middleton999 8 years ago

      Excellent news, Thanks for letting me know Pavel. Glad to help, love the product.

      DevExpress Support Team 8 years ago

        Thank you for your kind words, Alan. Have a really nice day!

        Answers approved by DevExpress Support

        created 8 years ago (modified 8 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)
          AM AM
          Alan Middleton999 8 years ago

            WOW fixed already - great work guys, thanks :)

            DevExpress Support Team 8 years ago

              You are welcome, Alan.
              The fix will be available with the next update.

              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.