Bug 21264 - Xamarin Studio possibly generates incorrect resource file in PCL project
Summary: Xamarin Studio possibly generates incorrect resource file in PCL project
Status: RESOLVED DUPLICATE of bug 21560
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-11 12:12 UTC by Prashant Cholachagudda
Modified: 2014-08-14 09:12 UTC (History)
6 users (show)

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

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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 21560

Description Prashant Cholachagudda 2014-07-11 12:12:56 UTC
Xamarin Studio on Mac generates the in correct Resources.Designer.cs class from a Resources.resx

Steps to reproduce:

I did exactly same steps on Windows and Mac:
1. Create a PCL project
2. Add a Resources file by "Add\New File\Misc" and choose Resources
3. In .resx, just before end 'root' tag add
<data name="Key1" xml:space="preserve">
<value>Value1</value>
</data>
4.Compile

On Mac it gives the error
error CS0234: The type or namespace name "ResXDataNode" does not exist in the namespace "System.Resources". Are you missing an assembly reference?

On Windows this works fine.
The problem is on Mac, the generated Resources.Designer.cs class has wrong generated properties:

internal static System.Resources.ResXDataNode Key1 {
get {
object obj = ResourceManager.GetObject("Key1", resourceCulture);
return ((System.Resources.ResXDataNode)(obj));
}
}

I assume ResXDataNode is not available in PCL and that is why build fails.
But the problem is the generated property should be using a string instead, not a ResXDataNode.

Compared to Windows:

/// <summary>
/// Looks up a localized string similar to Value1.
/// </summary>
internal static string Key1 {
get {
return ResourceManager.GetString("Key1", resourceCulture);
}
}
Comment 1 Mikayla Hutchinson [MSFT] 2014-07-13 20:52:01 UTC
Marek - This is handled by System.Resources.Tools.StronglyTypedResourceBuilder. It works on .NET but not on Mono.
Comment 2 Adam Kemp 2014-07-28 19:27:31 UTC
Please make this work on a Mac! I just stupidly converted all my projects to use the Windows-style resx generation code in our .csproj files (replacing our hacky custom generator) because I thought it all worked now. Turns out it only worked for us before because we were doing Android development on Windows. Now I have to shelve my .resx changes, generate the file on Windows, and then shelve it again to get it back to a Mac.
Comment 3 Andrei.N 2014-07-29 00:30:17 UTC
I reported this by email to Prashant, I'm looking forward for a fix
Comment 4 Guillermo Gutiérrez 2014-07-29 06:33:11 UTC
In Bug 21560 they say that it's fixed for 5.3.0.327
Comment 5 Marek Safar 2014-08-14 09:12:13 UTC
This works for me with master XS, hence it's more duplicate of 21560  than BCL bug

*** This bug has been marked as a duplicate of bug 21560 ***