dotnet / dotnet/runtime

Microsoft.XmlSerializer.Generator broken on .NET 10.0 RC

Open
#120,734 5 comments 3 reactions 0 assignees View on GitHub
area-Serialization regression-from-last-release
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Description

Using Microsoft.XmlSerializer.Generator as documented on https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator does not work on .NET 10.0 RC due to a System.Runtime assembly loading issue. Attempting to use the serializer generator as documented causes the following output during build:

```
sgen succeeded with 3 warning(s) (0,8s) → bin\Debug\net10.0\sgen.dll
SGEN : warning SGEN1: Could not load file or assembly 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\10.0.0-rc.1.25451.107\ref\net10.0\System.Runtime.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
SGEN : warning SGEN1: Could not load file or assembly 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\10.0.0-rc.1.25451.107\ref\net10.0\System.Runtime.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
C:\Users\Markus\.nuget\packages\microsoft.xmlserializer.generator\10.0.0-rc.1.25451.107\build\Microsoft.XmlSerializer.Generator.targets(52,5): warning SGEN: Failed to generate the serializer for sgen.dll. Please follow the instructions at https://go.microsoft.com/fwlink/?linkid=858594 and try again.
```

We depend on the XML serializer generator in our products, so this is a blocking issue for us in order to release a .NET 10.0 version of our products.

Note that these errors are emitted when using Microsoft.XmlSerializer.Generator package and tool version `10.0.0-rc.1.25451.107`.

```


Exe
net10.0




```

### Reproduction Steps

Follow the minimal example shown at https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator using .NET 10.0 RC.

### Expected behavior

The serializer should be generated.

### Actual behavior

The serializer fails to be generated because of a System.Runtime assembly loading problem.

### Regression?

This worked on .NET 6.0 and .NET 8.0.

### Known Workarounds

Disabling the use of the serializer generator, but this causes an unacceptable performance hit in our product.

### Configuration

.NET 10.0.0-rc.1.25451.107
Windows 11 24H2 (OS build 26100.6584)
x64

Same problem occurs on Linux.

### Other information

Issue previously reported on https://developercommunity.visualstudio.com/t/MicrosoftXmlSerializerGenerator-broken/10980787 ; was told to report it here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.