8

Weird problem, started with migration to Visual Studio 2010.

Some forms, when opened, will have some objects' properties set to a string that is empty in resource file. Most often these are control properties like ImageKey, ToolTipText and for UltraGrid some columns get columnX.Header.Caption set to that string. This will obviously remove set images and give wrong column header texts in other locales. Additionally tooltips will show up in weird places (like tab panel body).

This string (strSaveInterestDetails8 below) is empty in Strings.resx (<value />), but not empty in Strings.fi.resx. When I changed this string to have a space, designer started to use an other "empty" string from Strings.resx..

These forms are all derived from common base, but it does not have anything special/suspicious. Debugging these from additional devenv instance failed, since the debugger never broke on the set breakpoints (thrown exceptions in internal VS code were caught).

example:

ultraGridColumn23.Header.Caption = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
...
this._timespanCheck.ImageKey = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
...
this.tabPage1.ImageKey = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
this.tabPage1.ToolTipText = global::Company.Module.Properties.Strings.strSaveInterestDetails8;

So has anyone run into something similar or has better google-fu?

Pasi Savolainen
  • 2,460
  • 1
  • 22
  • 35
  • What does the original code look like? Are you using `""` or `string.Empty`? – Oded Sep 23 '10 at 10:45
  • Previously they were not set at all (at least ImageKey / ToolTipText ones). – Pasi Savolainen Sep 23 '10 at 10:55
  • It happened to me too, in my case I had removed the empty strings (and forced VS to identifying the change). Could you remove the empty strings or make them non-empty? – Asaf R Nov 24 '10 at 12:06
  • 1
    @AsafR: When I changed them to be non-empty, Visual Studio just picked the next one that was empty. Didn't go into changing all the empty strings. We're still fighting this bullshit, if not daily then weekly. Have a macro that removes all lines with references to that specific empty string.. – Pasi Savolainen Nov 24 '10 at 13:34
  • You can replace all empty strings with Search & Replace using RegExp, if you don't need them to be empty. Visual Studio will still need a small help refreshing, but I can guide you through that. Is getting rid of all the empty resource strings something you're willing to do? – Asaf R Nov 24 '10 at 20:14
  • Hello, Pasi! Did you find the solution of this problem? I have exactly the same trouble. – Igor Soloydenko Oct 21 '10 at 10:40
  • No solution yet. We've removed those by hand (macro that searches for the string and removes whole line..). Also some dialogs seem to work after I remove these funny values via designer, I've not looked at what difference that makes in diff. – Pasi Savolainen Oct 21 '10 at 11:41

4 Answers4

6

This is a long standing bug in Visual Studio. Microsoft is aware of the issue, but still no fix. You can vote up the issue here:

https://connect.microsoft.com/VisualStudio/feedback/details/683661/windows-forms-designer-cs-files-corrupt-after-changing-language#tabs

molesmoke
  • 76
  • 1
  • 4
2

In our experience, this is usually a bug caused by the presence of the text string <value /> in the xml of a resx file. When you edit and save the form designer, all the empty strings "" in the designer file get mapped to the key associated with this self-terminating node.

Theses spurious <value /> entries sometimes appear if you start building a project while the resource editor has still got the flashing cursor in the 'new row' line, and there is no text associated with the key.

Search the project for <value /> and eliminate them from the resx files. Then clean and rebuild the project, (which will fail), then fix the compile errors by replacing them with ""

Hope this helps.

2

I'm having the same problem, but with VS2008. However, a VS2010 Web Developer Express version is also installed on my system (since a couple of months). First, I was developing in a project that uses multiple language resources and then I opened up another VS solution to change something on a form. The Windows Form Designer replaced all the empty strings in the Designer.vb file with a string resource identifier from the first project!
I could solve the problem by closing Visual Studio and reopen the solution.

Kevin D.
  • 21
  • 2
0

I think this will work for you. Check the accepted solution.

Or maybe this.

Community
  • 1
  • 1
Nayan
  • 3,092
  • 25
  • 34
  • 1
    This is not relevant in this case. Application has several hundreds of forms. Full scale migration to another type of localization is highly unlikely. – Pasi Savolainen Sep 23 '10 at 12:01