Bug 15032 - ResXResourceWriter should be able to manage null values
Summary: ResXResourceWriter should be able to manage null values
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: master
Hardware: All All
: Lowest normal
Target Milestone: Community
Assignee: Bugzilla
Depends on:
Reported: 2013-09-27 03:49 UTC by David Schmitt
Modified: 2017-09-01 11:56 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

example solution (7.27 KB, application/x-zip-compressed)
2013-09-27 03:49 UTC, David Schmitt
example output (6.08 KB, application/xml)
2013-09-27 03:50 UTC, David Schmitt

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 15032 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description David Schmitt 2013-09-27 03:49:39 UTC
Created attachment 5003 [details]
example solution

The attached example solution works under .net4 but throws an exception when running on mono (tested 2.10 and 3.0, I found later that the same code is still in master since ages).

The attached temp.resx is the output from running the program on Windows.

Here is the relevant code:

            using (var writer = new System.Resources.ResXResourceWriter("temp.resx"))
                writer.AddResource("FooWorks", "Hello, World!");
                writer.AddResource("Foo1", String.Empty);
                writer.AddResource("Foo2", (string)null);

and output:

		  <data name="FooWorks" xml:space="preserve">
			<value>Hello, World!</value>
		  <data name="Foo1" xml:space="preserve">
			<value />
		  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
		  <data name="Foo2" type="System.Resources.ResXNullRef, System.Windows.Forms">
			<value />
Comment 1 David Schmitt 2013-09-27 03:50:01 UTC
Created attachment 5004 [details]
example output
Comment 2 Miguel de Icaza [MSFT] 2014-02-12 17:27:06 UTC
Setting priority to lowest, since Windows.Forms is no longer being developed actively.