docs icon indicating copy to clipboard operation
docs copied to clipboard

Document IL2125 and IL3058 transitive reference compatibility warnings

Open Copilot opened this issue 1 week ago • 0 comments

Summary

Documents new analyzer warnings IL2125 and IL3058 introduced in dotnet/runtime#118180 for verifying transitive dependency compatibility with trimming and Native AOT.

New warning documentation:

  • IL2125: Referenced assembly is not annotated for trim compatibility - emitted when VerifyReferenceTrimCompatibility=true and a referenced assembly lacks IsTrimmable metadata
  • IL3058: Referenced assembly is not annotated for AOT compatibility - emitted when VerifyReferenceAotCompatibility=true and a referenced assembly lacks IsAotCompatible metadata

Updated conceptual documentation:

  • Added VerifyReferenceTrimCompatibility property to trim preparation guide
  • Added VerifyReferenceAotCompatibility property to Native AOT overview
  • Added note that IsAotCompatible metadata was introduced in .NET 10

Documentation approach:

  • Uses consistent terminology: "annotated for trim/AOT compatibility" throughout
  • Provides two options to fix violations: update the library or disable verification
  • Does not suggest warning suppression (these warnings cannot be suppressed at source location)
  • Includes ai-usage: ai-assisted disclosure in frontmatter per .NET documentation guidelines
  • Displays warning messages in separate blocks rather than inline comments, since these are compilation-level warnings that don't point to specific source lines
  • Documents recommended ways to enable the warnings: PublishTrimmed/IsTrimmable for trim warnings, and PublishAot/IsAotCompatible for AOT warnings

Both properties are opt-in, allowing library authors to enforce that all dependencies explicitly declare trim/AOT compatibility:

<PropertyGroup>
  <IsTrimmable>true</IsTrimmable>
  <VerifyReferenceTrimCompatibility>true</VerifyReferenceTrimCompatibility>
</PropertyGroup>
Original prompt

Clone https://github.com/dotnet/runtime/pull/118180 and inspect the changes. Then write documentation for the new feature.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/core/deploying/native-aot/index.md Native AOT deployment
docs/core/deploying/native-aot/warnings/il3058.md "IL3058: Referenced assembly is not annotated for AOT compatibility"
docs/core/deploying/trimming/prepare-libraries-for-trimming.md Prepare .NET libraries for trimming
docs/core/deploying/trimming/trim-warnings/il2125.md IL2125: Referenced assembly is not annotated for trim compatibility

Copilot avatar Dec 02 '25 19:12 Copilot