Ticket T738370
Visible to All Users

Lost designer code if localized button image is changed in the control

created 6 years ago

Hello!

Sometimes I found some issues with localized code. E.g. like now. If I try to modify localized code, then strange things happens…

In the past I have had created some control/component to edit paths for some purposes. There were custom buttons with some custom images. I was completely unlocalized. Later I localize it subsequently. It was working till today. Now I would like to change the images, but it doesn't work properly. See attached video.

I guess, that somehow localization causes, that image references were transformed to RESX inner bitmaps. But if I switch to some language form the default one, it causes designer errors. Bitmaps are not accessible in selected localization and generated code disappears!

It is not first time I see similar issue. Sometimes, not often, but sometimes some code disappears. I tear my hair at this situations. It's really uncomfortable and hard to understand. Then I need to implement it again and again and again. And I can't be sure, that next time it will be correct…

Please, how can I fix this issue without implementing old code again and how can I omit this behaviour for the future? Thanks in advance.

Best Regards,

Radim

PS: I am out of office 8. - 12. 5. 2019.

Answers approved by DevExpress Support

created 6 years ago

Hello Radim,

Thank you for the attached video. The issue you faced looks very similar to the one discussed in the ButtonEdit - An image assigned to a button is lost when a form's language is changed to Default thread. In fact, there are several similar issues that occur when the standard localization mechanism is used and these issues are related to the VisualStudio doesn't update all the localizable Form's resx files when localizable properties are changed Microsoft issue. We improved this behavior in newer versions of our components and found that it's possible to avoid the issue by disabling the Optimized Code Generation option in Visual Studio. Please test this approach. If possible, I also recommend that you consider updating your components to a more recent version.

I look forward to your results.

    Show previous comments (17)
    DevExpress Support Team 6 years ago

      Hi Radim,

      Sasha is out of the issue today, so please let me chime in. As you already know, the behavior you are describing is not specific to our controls. It is caused by the Visual Studio serialization mechanism. You can reproduce a similar behavior with a standard TreeView as well. I recorded a video showing the required steps. As you see, Visual Studio generates Base64 entries in the resx file for TreeView nodes. If you decode those strings, you'll see that they contain references to an assembly version. So, there is not much we can do here to avoid this behavior.
      One of the possible workarounds would be to populate your editors with items in code at runtime. Could you please test this approach and let me know if it suitable?

        Hi Pavel,

        I understand, what was happend. My last reply was an response to the information, that Sasha can't reproduce the issue. It seems, that Sasha used different version of VS (VS 2017?), maybe newer versions of VS works better (I guess).

        I know that adding runtime items can solve the problem. I don't remember, why I modified designer file in the past. But I prefer to use the Designer usually. Therefore I was also asking for enhanced (combo box) items designer editor to add better e.g. enums items or other types items than primitive ones (e.g. System.Type like in my example).

        Best Regards,

        Radim

        DevExpress Support Team 6 years ago

          Hi Radim,

          I managed to reproduce the same behavior using Visual Studio 2017.
          As for the enhanced ComboBoxEdit item designer, I will pass your thoughts onto the team. Still, the most robust way to avoid the issue is to assign items at runtime.
          If there is anything else I can do for you, please let me know.

          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.