Closed rainersigwald closed 5 years ago
From @rainersigwald on Monday, August 19, 2019 6:15:29 PM
ResXNullRef
probably needs special handling in MSBuild. I'll duplicate this bug over there and look into that.
Can you share a repro for your problems with ResXFileRef
? I have a fix almost ready for byte arrays and memory streams, but I'm not sure that's your case: microsoft/msbuild#4607.
I'll try to make a repro for ResXFileRef
. Meanwhile, this is what we use in the .resx file:
<data name="icondef" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icondef.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1250</value>
</data>
and this is how it is accessed from code:
ResourceManager resources = new ResourceManager(typeof(Resources.IM.Emoticons));
XmlTextReader xmlreader = new XmlTextReader(new StringReader(resources.GetString("icondef")));
or alternatively the pregenerated .Designer.cs code:
internal static string icondef {
get {
return ResourceManager.GetString("icondef", resourceCulture);
}
}
can you quickly try changing the String type to Version=4.0.0.0
? I have a guess about the problem and its fix (which would be in MSBuild but you could work around with that change).
Ha, surprisingly you came up with the same workaround as my colleague. Changing to Version=4.0.0.0
seemed to help.
Great! That's now microsoft/msbuild#4636.
From @filipnavara on Monday, August 19, 2019 6:06:17 PM
Problem description:
.resx files using
System.Resources.ResXNullRef
orSystem.Resources.ResXFileRef
cannot be loaded.Actual behavior:
Expected behavior:
No crash.
Minimal repro:
WindowsFormsApp1.zip
Details:
This is new behavior with .NET Core Preview 8 and VS 2019 Preview 16.3.0 Preview 2. With earlier VS previews the resources were compiled using NetFX msbuild. Now a new flow in msbuild is used that avoids the deserialization and serialization of binary resources. The new resource compilation process in msbuild and CoreFX seems to be broken for
ResXNullRef
andResXFileRef
at least. It is not immediately obvious whether it is bug in WinForms, CoreFX or msbuild but it certainly is broken now. /cc @rainersigwaldCopied from original issue: dotnet/winforms#1662