-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YamlDotNet 16.2.0 produces trim warnings, while YamlDotNet 13.1.0 does not #1012
Comments
Can you share the code where you initialize the serializer and/or deserializer? |
We currently have: namespace Redpoint.Uet.BuildPipeline.Executors.GitLab
{
using YamlDotNet.Serialization;
[YamlStaticContext]
public partial class GitLabYamlStaticContext : YamlDotNet.Serialization.StaticContext
{
}
} and we serialize it like this: using (var stream = new StreamWriter(buildServerOutputFilePath))
{
var aotContext = new GitLabYamlStaticContext();
var serializer = new StaticSerializerBuilder(aotContext)
.WithQuotingNecessaryStrings()
.ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitNull)
.Build();
var yaml = serializer.Serialize(file);
await stream.WriteLineAsync(yaml).ConfigureAwait(false);
} You can see the full assembly implementation here: https://github.com/RedpointGames/uet/tree/main/UET/Redpoint.Uet.BuildPipeline.Executors.GitLab |
Thanks. I’ll see what I can find. |
Just got where the problem is, it was added with some of the fsharp code. I'll see what I can do to fix this. It shouldn't break anything in c#, just in f#. In theory.
|
I just pushed this fix out, you should see it in nuget shortly. |
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:
The text was updated successfully, but these errors were encountered: