Describe the bug
When building a trimmed executable against YamlDotNet 13.1.0, the .NET linker is able to successfully build. After upgrading to YamlDotNet 16.2.0, linking now fails with:
/Users/runner/.nuget/packages/yamldotnet/16.2.0/lib/net8.0/YamlDotNet.dll : error IL2104: Assembly 'YamlDotNet' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/runner/work/uet/uet/UET/uet/uet.csproj]
To Reproduce
Create a project that has these dependencies:
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="13.0.2" />
<PackageReference Include="YamlDotNet" Version="13.1.0" />
and enable trim warnings and other analyzers with:
<PropertyGroup>
<IsTrimmable>true</IsTrimmable>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>All</AnalysisMode>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>
</PropertyGroup>
The project will build successfully. Now modify the project dependencies to:
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.2.0" />
<PackageReference Include="YamlDotNet" Version="16.2.0" />
and it will fail with that trim warning.
This issue could be caught in the YamlDotNet build process by adding the following property to the YamlDotNet project, though it will likely generate a bunch of warnings on dynamic APIs that either need to be addressed or silenced:
<PropertyGroup>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
</PropertyGroup>
Describe the bug
When building a trimmed executable against YamlDotNet 13.1.0, the .NET linker is able to successfully build. After upgrading to YamlDotNet 16.2.0, linking now fails with:
To Reproduce
Create a project that has these dependencies:
and enable trim warnings and other analyzers with:
The project will build successfully. Now modify the project dependencies to:
and it will fail with that trim warning.
This issue could be caught in the YamlDotNet build process by adding the following property to the YamlDotNet project, though it will likely generate a bunch of warnings on dynamic APIs that either need to be addressed or silenced: