Skip to content

Declare the library compatible with NativeAOT - #186

Merged
JohnCampionJr merged 1 commit into
tomlm:mainfrom
confetty-sh:declare-aot-compatible
Nov 1, 2026
Merged

JohnCampionJr merged 1 commit into
tomlm:mainfrom
confetty-sh:declare-aot-compatible

Conversation

@JohnCampionJr

Copy link
Copy Markdown
Collaborator

Sets <IsAotCompatible>true</IsAotCompatible> on XTerm.NET.csproj. That's the whole change.

The library already works under NativeAOT: it has no dependencies, and its only reflection-style call is Assembly.GetName().Version for XTVERSION. But nothing declared that, and nothing would notice a change that broke it. This property marks the package as safe for AOT and trimming, and turns on the AOT, trim and single-file analyzers, so an unsafe change raises a build warning here rather than in a host's publish. They are warnings, not errors, so they won't fail a build on their own.

How I checked

  • Analyzers: 0 IL warnings on the library. A deliberately unsafe call planted in a scratch copy (Activator.CreateInstance(Type.GetType(n)!), MakeGenericType) raised IL2057 and IL3050, so they can fire.
  • Native run: a small app published with PublishAot and run natively on macOS arm64 passed all 11 checks: printing, SGR colours, XTVERSION (reporting the right version through that one call), OSC 11, device attributes, Sixel and kitty images (these two only that they don't throw), Find and BufferScan, 5,000 scrolled lines with wide characters, clusters and emoji, and resize. That was against the commit before the version bump to 3.0.2.
  • Tests: the whole XTerm.NET.Tests project passes with the property set: 2547 passed, 1 skipped, 0 failed.

Only macOS arm64 was run natively; there's no AOT publish in CI, so the analyzers are the ongoing guard.

🤖 Generated with Claude Code

The library already compiles and runs under NativeAOT: it has no
dependencies, and its only reflection-style call is reading its own
assembly version. Nothing said so, and nothing would notice a change
that broke it.

IsAotCompatible marks the package as safe for AOT and trimming, and turns
on the AOT, trim and single-file analyzers, so a change that isn't safe now
raises a build warning here rather than in a host's publish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JohnCampionJr
JohnCampionJr merged commit d2eca95 into tomlm:main Nov 1, 2026
4 checks passed
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.

1 participant