Description
When using the Microsoft.XmlSerializer.Generator NuGet package (v6 and also pre v7), I receive some warnings during compilation.
Reproduction Steps
Can supply simple sample app, but I used the description more or less written here.
Expected behavior
The Microsoft.XmlSerializer.Generator tool generates an optimized assembly for the XmlSerializer without warnings.
Actual behavior
The Microsoft.XmlSerializer.Generator generates warnings:
1>------ Erstellen gestartet: Projekt: xxx, Konfiguration: Debug Any CPU ------
1>xxx-> C:\xxx\bin\Debug\net6.0-windows\xxx.dll
1>.NET Xml Serialization Generation Utility, Version 7.0.0-preview.7.22375.6]
1>SGEN : warning SGEN1: Could not load file or assembly 'PresentationFramework, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
1>SGEN : warning SGEN1: Cannot load a reference assembly for execution.
1>SGEN : warning SGEN1: Could not load file or assembly 'Microsoft.VisualBasic.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
1>SGEN : warning SGEN1: Cannot load a reference assembly for execution.
1>SGEN : warning SGEN1: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
1>SGEN : warning SGEN1: Cannot load a reference assembly for execution.
1>Serialization Code File Name: C:\xxx\obj\Debug\net6.0-windows\xxx.XmlSerializers.cs.
1>Generated serialization code for assembly C:\xxx\obj\Debug\net6.0-windows\xxx.dll --> 'C:\xxx\obj\Debug\net6.0-windows\xxx.XmlSerializers.cs'.
1>Erstellen des Projekts xxx.csproj beendet.
========== Erstellen: 1 erfolgreich, 0 Fehler, 2 aktuell, 0 übersprungen ==========
Regression?
It's the first time I try the Microsoft.XmlSerializer.Generator tool so I can't say.
Known Workarounds
Add following in csproj file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<NoWarn>SGEN1</NoWarn>
</PropertyGroup>
Configuration
dotnet --info
.NET SDK (gemäß "global.json"):
Version: 7.0.100-preview.7.22377.5
Commit: ba310d9309
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\
Host:
Version: 7.0.0-preview.7.22375.6
Architecture: x64
Commit: eecb028078
.NET SDKs installed:
3.1.408 [C:\Program Files\dotnet\sdk]
3.1.421 [C:\Program Files\dotnet\sdk]
5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
5.0.411 [C:\Program Files\dotnet\sdk]
6.0.108 [C:\Program Files\dotnet\sdk]
6.0.303 [C:\Program Files\dotnet\sdk]
6.0.400 [C:\Program Files\dotnet\sdk]
7.0.100-preview.7.22377.5 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0-preview.7.22376.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0-preview.7.22375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.0-preview.7.22377.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Other information
I can use the generated xxx.XmlSerializers.dll, but this warnings are annoying...
Description
When using the Microsoft.XmlSerializer.Generator NuGet package (v6 and also pre v7), I receive some warnings during compilation.
Reproduction Steps
Can supply simple sample app, but I used the description more or less written here.
Expected behavior
The Microsoft.XmlSerializer.Generator tool generates an optimized assembly for the XmlSerializer without warnings.
Actual behavior
The Microsoft.XmlSerializer.Generator generates warnings:
Regression?
It's the first time I try the Microsoft.XmlSerializer.Generator tool so I can't say.
Known Workarounds
Add following in csproj file:
Configuration
Other information
I can use the generated
xxx.XmlSerializers.dll, but this warnings are annoying...