From e3cd060cfedf5599b686678252ab2463abb2b07c Mon Sep 17 00:00:00 2001 From: Ryan Buckley Date: Sun, 1 Dec 2024 14:18:13 +0000 Subject: [PATCH] Fix AOT trimming warnings --- src/OidcClient/Infrastructure/LogSerializer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OidcClient/Infrastructure/LogSerializer.cs b/src/OidcClient/Infrastructure/LogSerializer.cs index c1fb1f0..7e45256 100644 --- a/src/OidcClient/Infrastructure/LogSerializer.cs +++ b/src/OidcClient/Infrastructure/LogSerializer.cs @@ -28,6 +28,9 @@ 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 = "")] +#endif static LogSerializer() { JsonOptions.Converters.Add(new JsonStringEnumConverter()); @@ -39,7 +42,10 @@ static LogSerializer() /// The object. /// #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) {