Skip to content

Microsoft.XmlSerializer.Generator fails to generate serializer for assemblies not targeting netstandard2.0 #630

Description

@mconnew

The runtime config for the Microsoft.XmlSerializer.Generator specifies to run on netcoreapp2.0. When reflecting over application assembly to generator serializer, if the assembly is referencing for example NetCoreApp3.0, the version of System.Runtime referenced by the library can't be loaded.
The fix is to change the assembly loading code to use System.Reflection.MetadataLoadContext to reflect over the application assembly. We do use Type.GetCustomAttributes at least in sgen.cs so we would also need to make changes to use Type.GetCustomAttributesData. XmlSerializer.GenerateSerializer does the bulk of the work so there might need to be changes there as well.

Original issue: dotnet/corefx#41286

  • Port to 3.1.x

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions