From 09502fb14127d4179b4497e0b76f1b03b26e6efb Mon Sep 17 00:00:00 2001 From: Ryan Buckley Date: Sun, 1 Dec 2024 14:14:16 +0000 Subject: [PATCH 1/2] PublishAot in TrimmableAnalysis test project --- src/DPoP/DPoP.csproj | 5 +++-- src/IdentityTokenValidator/IdentityTokenValidator.csproj | 7 ++++--- src/OidcClient/OidcClient.csproj | 9 +++++---- test/TrimmableAnalysis/TrimmableAnalysis.csproj | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/DPoP/DPoP.csproj b/src/DPoP/DPoP.csproj index 22db7ab..82b6500 100644 --- a/src/DPoP/DPoP.csproj +++ b/src/DPoP/DPoP.csproj @@ -27,8 +27,9 @@ embedded - true - + true + true + True ../../key.snk diff --git a/src/IdentityTokenValidator/IdentityTokenValidator.csproj b/src/IdentityTokenValidator/IdentityTokenValidator.csproj index c05015a..ae15b86 100644 --- a/src/IdentityTokenValidator/IdentityTokenValidator.csproj +++ b/src/IdentityTokenValidator/IdentityTokenValidator.csproj @@ -4,7 +4,7 @@ IdentityModel.OidcClient IdentityModel.OidcClient.IdentityTokenValidator - netstandard2.0 + netstandard2.0;net8.0 OAuth2;OAuth 2.0;OpenID Connect;Security;Identity;IdentityServer Identity token validator for IdentityModeo.OidcClient based on the Microsoft JWT handler @@ -24,8 +24,9 @@ embedded - true - + true + true + True ../../key.snk diff --git a/src/OidcClient/OidcClient.csproj b/src/OidcClient/OidcClient.csproj index 9b6faf3..d825561 100644 --- a/src/OidcClient/OidcClient.csproj +++ b/src/OidcClient/OidcClient.csproj @@ -4,7 +4,7 @@ IdentityModel.OidcClient IdentityModel.OidcClient - netstandard2.0;net6.0 + netstandard2.0;net6.0;net8.0 latest IdentityModel.OidcClient @@ -27,8 +27,9 @@ embedded - true - + true + true + True ../../key.snk @@ -50,7 +51,7 @@ - + diff --git a/test/TrimmableAnalysis/TrimmableAnalysis.csproj b/test/TrimmableAnalysis/TrimmableAnalysis.csproj index e07ffad..7264453 100644 --- a/test/TrimmableAnalysis/TrimmableAnalysis.csproj +++ b/test/TrimmableAnalysis/TrimmableAnalysis.csproj @@ -4,7 +4,7 @@ Exe net8.0 enable - true + true false true false From 61e360c0ec9529994f0508685c0677ac1a6fce37 Mon Sep 17 00:00:00 2001 From: Ryan Buckley Date: Sun, 1 Dec 2024 14:18:13 +0000 Subject: [PATCH 2/2] Fix AOT trimming warnings --- src/OidcClient/Infrastructure/LogSerializer.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) {