Skip to content
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

Fix trimming warnings when publishing with Native AOT #451

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rabuckley
Copy link

This fixes the two AOT analysis warnings in this project

IdentityModel.OidcClient/src/OidcClient/Infrastructure/LogSerializer.cs(52): AOT analysis warning IL3050: IdentityModel.OidcClient.Infrastructure.LogSerializer.Serialize(Object): Using member 'System.Text.Json.JsonSerializer.Serialize<Object>(Object,JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.
IdentityModel.OidcClient/src/OidcClient/Infrastructure/LogSerializer.cs(36): AOT analysis warning IL3050: IdentityModel.OidcClient.Infrastructure.LogSerializer..cctor(): Using member 'System.Text.Json.Serialization.JsonStringEnumConverter.JsonStringEnumConverter()' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JsonStringEnumConverter cannot be statically analyzed and requires runtime code generation. Applications should use the generic JsonStringEnumConverter<TEnum> instead.

When targetting net9.0 there are no errors. When targeting net8.0, there is one remaining error, which is tracked in the dotnet runtime by dotnet/runtime#109958.

@rabuckley rabuckley force-pushed the native-aot-trimming branch from e3cd060 to 274aa9a Compare December 1, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant