diff --git a/src/OidcClient/Infrastructure/LogSerializer.cs b/src/OidcClient/Infrastructure/LogSerializer.cs
index c1fb1f0..82aff16 100644
--- a/src/OidcClient/Infrastructure/LogSerializer.cs
+++ b/src/OidcClient/Infrastructure/LogSerializer.cs
@@ -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());
@@ -39,7 +44,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)
{