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开发者_如何学C 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?
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
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.
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.
I think this will work for you. Check the accepted solution.
Or maybe this.
精彩评论