Skip to content

Enable AOT compatibility analysis - #510

Merged
agocke merged 8 commits into
mainfrom
enable-aot-compatibility
Aug 26, 2026
Merged

agocke merged 8 commits into
mainfrom
enable-aot-compatibility

Conversation

@agocke

@agocke agocke commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Enable AOT compatibility analysis for Cecil by adding a net10.0 analyzer target with IsAotCompatible=true.

  • Use constant assembly-qualified names for optional PDB/MDB providers so trimming can preserve their constructors.
  • Mark reflection-based import APIs with RequiresUnreferencedCode.
  • Polyfill RequiresUnreferencedCodeAttribute, DynamicallyAccessedMembersAttribute, and DynamicallyAccessedMemberTypes so annotations are also shipped in the netstandard2.0 assembly.
  • Replace or isolate obsolete and Windows-only APIs on modern .NET.
  • Preserve the existing netstandard2.0 product target.

Validation:

  • dotnet build Mono.Cecil.sln --no-incremental --verbosity:minimal
  • Zero warnings and errors.

agocke added 5 commits August 18, 2026 12:35
Add a net8.0 analyzer target, make optional symbol provider lookup trim-safe, and annotate reflection import APIs that are incompatible with trimming.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 844b37b7-122c-40c2-a4c2-d499dd6e59bc
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 844b37b7-122c-40c2-a4c2-d499dd6e59bc
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 844b37b7-122c-40c2-a4c2-d499dd6e59bc
Use supported cryptography APIs, guard Windows-only CSP fallbacks, and exclude unsupported legacy reflection APIs from the net10 target.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 844b37b7-122c-40c2-a4c2-d499dd6e59bc
Polyfill RequiresUnreferencedCodeAttribute for older targets and emit reflection import annotations without target framework guards.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 844b37b7-122c-40c2-a4c2-d499dd6e59bc
@@ -0,0 +1,19 @@
#if !NET

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably needs license header

agocke added 2 commits August 19, 2026 14:26
Polyfill DynamicallyAccessedMembersAttribute and DynamicallyAccessedMemberTypes so symbol provider constructor requirements are emitted for older targets.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 844b37b7-122c-40c2-a4c2-d499dd6e59bc
@agocke
agocke requested a review from sbomer August 19, 2026 21:31
Comment thread Mono.Cecil.csproj Resolved
Co-authored-by: Alexander Köplinger <[email protected]>
@agocke
agocke merged commit e8e6dc4 into main Aug 26, 2026
6 checks passed
@agocke
agocke deleted the enable-aot-compatibility branch August 26, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants