Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Systematically resolves .NET IL trim and Native AOT analyzer warnings by adding annotations and refactoring reflection-heavy code.
68% 91%+23 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 15 of 22 without it.
We are serializing an Azure.Core.ResponseError instance using JsonSerializer.Serialize(writer, error) and getting IL2026. Should we add [JsonSerializable(typeof(ResponseError))] to our custom JsonSerializerContext?
Advises against placing third-party external package types into the project's own JsonSerializerContext.
3 of 3 safety checks passed
Make .NET projects compatible with Native AOT and trimming by systematically resolving all IL trim/AOT analyzer warnings.
Do not use this skill when the project exclusively targets .NET Framework (net4x), which does not support the trim/AOT analyzers.
An existing .NET project targeting net8.0 or later (or multi-targeting with at least one net8.0+ TFM) and the corresponding .NET SDK installed.
Native AOT and the IL trimmer perform static analysis to determine what code is reachable. Reflection can break this analysis because the trimmer can't see what types/members are accessed at runtime. The IsAotCompatible property enables analyzers that flag these issues as build warnings (ILXXXX codes).
#pragma warning disable for IL warnings. It hides warnings from the Roslyn analyzer at build time, but the IL linker and AOT compiler still see the issue. The code will fail at trim/publish time.[UnconditionalSuppressMessage]. It tells both the analyzer AND the linker to ignore the warning, meaning the trimmer cannot verify safety. Raising an error at build time is always preferable to hiding the issue and having it silently break at runtime.[DynamicallyAccessedMembers] annotations to flow type information through the call chain.Type through object[]).[RequiresUnreferencedCode] / [RequiresDynamicCode] / [RequiresAssemblyFiles] to mark methods as fundamentally incompatible with trimming, propagating the requirement to callers. This surfaces the issue clearly rather than hiding it — callers must explicitly acknowledge the incompatibility.Next to this one in the catalogue, plus more from the same author.