0

Json and JsonSubTypes in a C# / .NET 9 project with AOT-publishing enabled. These 2 libs are not trimming/AOT ready yet, but I'm sure the types that involved in my project are all reserved and working no problem after AOT publishing. However, I'm getting the following IL warnings and did not seem to find a way to suppress them just for these 2 libs, since I would like to continue to get warnings if there are same issues from other libs.

Does anyone know if this is achievable?

C:\Users\az\.nuget\packages\newtonsoft.json\13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll : warning IL2104: Assembly 'Newtonsoft.Json' produced trim warnings. For more information see https://aka.ms/il2104 [C:\Users\az\my-proj.csproj]
C:\Users\az\.nuget\packages\newtonsoft.json\13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll : warning IL3053: Assembly 'Newtonsoft.Json' produced AOT analysis warnings. [C:\Users\az\my-proj.csproj]
C:\Users\az\.nuget\packages\jsonsubtypes\2.0.1\lib\netstandard2.0\JsonSubTypes.dll : warning IL3053: Assembly 'JsonSubTypes' produced AOT analysis warnings. [C:\Users\az\my-proj.csproj]
C:\Users\az\.nuget\packages\jsonsubtypes\2.0.1\lib\netstandard2.0\JsonSubTypes.dll : warning IL2104: Assembly 'JsonSubTypes' produced trim warnings. For more information see https://aka.ms/il2104 [C:\Users\az\my-proj.csproj]

I've tried all options mentioned here: https://learn.microsoft.com/en-us/visualstudio/code-quality/in-source-suppression-overview?view=vs-2022&tabs=csharp#suppressmessage-attribute

but none works for dependent libs. I don't want to suppress all IL2104 and IL3053 since that could hide issues that I did not examine.

1
  • I think (I've not explored that yet myself) you can add configuration (as embedded resource) to your "library" assemblies to avoid this. See devblogs.microsoft.com/dotnet/… Commented May 17 at 15:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.