Skip to content

ResXNullRef/ResXFileRef resource serialization is broken #1662

Closed

Description

@filipnavara
  • .NET Core Version: 3.0 Preview 8
  • Have you experienced this same bug with .NET Framework?: No

Problem description:

.resx files using System.Resources.ResXNullRef or System.Resources.ResXFileRef cannot be loaded.

Actual behavior:

System.NotSupportedException
  HResult=0x80131515
  Message=TypeConverter cannot convert from System.String.
  Source=System.ComponentModel.TypeConverter
  StackTrace:
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
   at System.Resources.Extensions.DeserializingResourceReader.DeserializeObject(Int32 typeIndex)
   at System.Resources.Extensions.DeserializingResourceReader._LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
   at System.Resources.Extensions.DeserializingResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
   at System.Resources.Extensions.DeserializingResourceReader.ResourceEnumerator.get_Entry()
   at System.Resources.Extensions.DeserializingResourceReader.ResourceEnumerator.get_Current()
   at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   at System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
   at System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName)
   at WindowsFormsApp1.Form1.InitializeComponent() in C:\Users\Filip Navara\Source\Repos\WindowsFormsApp1\WindowsFormsApp1\Form1.Designer.cs:line 36
   at WindowsFormsApp1.Form1..ctor() in C:\Users\Filip Navara\Source\Repos\WindowsFormsApp1\WindowsFormsApp1\Form1.cs:line 17
   at WindowsFormsApp1.Program.Main() in C:\Users\Filip Navara\Source\Repos\WindowsFormsApp1\WindowsFormsApp1\Program.cs:line 19

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 and ResXFileRef at least. It is not immediately obvious whether it is bug in WinForms, CoreFX or msbuild but it certainly is broken now. /cc @rainersigwald

Activity

  1. rainersigwald commented on Aug 19, 2019

    @rainersigwald
    Member

    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: dotnet/msbuild#4607.

  2. rainersigwald commented on Aug 19, 2019

    @rainersigwald
    Member

    This issue was moved to dotnet/msbuild#4634

  3. ghost locked as resolved and limited conversation to collaborators on Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions