Skip to content

Commit

Permalink
Fix AOT trimming warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rabuckley committed Dec 1, 2024
1 parent 09502fb commit 61e360c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/OidcClient/Infrastructure/LogSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public static class LogSerializer
WriteIndented = true
};

#if NET7_0_OR_GREATER
[UnconditionalSuppressMessage("AOT",
"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.",
Justification = "Code using `JsonOptions` is guarded by `RequiresDynamicCodeAttribute`")]
#endif
static LogSerializer()
{
JsonOptions.Converters.Add(new JsonStringEnumConverter());
Expand All @@ -39,7 +44,10 @@ static LogSerializer()
/// <param name="logObject">The object.</param>
/// <returns></returns>
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode("The log serializer uses reflection in a way that is incompatible with trimming")]
[RequiresUnreferencedCode("The log serializer uses reflection in a way that is incompatible with trimming")]
#endif
#if NET7_0_OR_GREATER
[RequiresDynamicCode("The log serializer uses reflection in a way that is incompatible with trimming")]
#endif
public static string Serialize(object logObject)
{
Expand Down

0 comments on commit 61e360c

Please sign in to comment.