Bug Report T490492
Visible to All Users

Linked Identifiers - The resx file is broken when it contains a link and is edited via a designer

created 8 years ago

Generating a string resource entry in a resource file (Resources.resx) and deleting the entry again by the VS string resource editor results in a corrupted .resx file. The resource editor reports 'ResX file Data at the root level is invalid. Line 1, position 1, cannot be parsed.'.

This can be reproduced by creating a small C# console application:

Add a string resource manually ("Hello1").
Insert a string literal in the Main method of Program.cs: Console.WriteLine("Hello2");
Use the CodeRush for Roslyn 'Extract String to Resource' refactoring tool and convert "Hello2" to a string resource.
The program compiles without errors and behaves correctly.
After deleting "Hello2" again, the Resources.resx file is corrupted, compilation is not possible.
It does not happen when deleting the manually added entry "Hello1".

I could reproduce this behavior with Visual Studio 2015 and 2017.

Comments (3)
DevExpress Support Team 8 years ago

    Hi,

    Thank you for your report. I have managed to reproduce this problem locally and we will fix it in our future builds.
    As a workaround, I suggest that you accept a green link (a rectangle around the name of a resource) after applying the Extract String to Resource refactoring and renaming the name of a created resource. You can do this by pressing the Enter key. In this case, the problem will not be reproduced.

      Andrew,

      this works fine and is an acceptable workaround.
      Thanks for your help!

      Gerhard

      DevExpress Support Team 8 years ago

        You are welcome!

        I have a good news. We have to rewrite the logic of this refactoring and starting with the 16.2.7 version, this problem will be fixed. Now this refactoring does not apply changes while a resource name will not be accepted by the Enter key.

        Answers approved by DevExpress Support

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

          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.