Skip to content

Declare Native AOT compatibility for FastEnum.Core - #135

Merged
xin9le merged 3 commits into
mainfrom
feature/NativeAOT
Nov 24, 2026
Merged

xin9le merged 3 commits into
mainfrom
feature/NativeAOT

Conversation

@xin9le

@xin9le xin9le commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Summary

FastEnum already worked with Native AOT, but it did not say so. This PR adds that declaration to the package.

Changes

  • FastEnum.Core.csproj: Add <IsAotCompatible>true</IsAotCompatible>.
    • The package now declares that it supports Native AOT and trimming.
    • The trim, AOT and single-file analyzers now run on every build, so new code that breaks AOT is caught at build time.
    • It is set only on FastEnum.Core. FastEnum.Generators targets netstandard2.0 and runs inside the compiler, so setting it there only causes warning NETSDK1210.
  • README.md: Mention Native AOT and trimming support.

Verification

  • The whole solution builds with 0 warnings and 0 errors, including 0 IL2xxx / IL3xxx warnings.
  • A sample app was published with PublishAot=true (win-x64, .NET 11). The publish produced no trim or AOT warnings, and the native executable passed every check:
    • Regular API: GetValues, GetNames, GetMembers, GetName, FastToString, IsDefined, Parse / TryParse (including ignore case and numeric strings), IsFlags.
    • Reflection metadata: Member.FieldInfo, [EnumMember], [Label].
    • A long-based enum with its minimum and maximum values.
    • Source code generation API: GetName, TryParse through [FastEnum<T>].

🤖 Generated with Claude Code

@xin9le xin9le self-assigned this Nov 24, 2026
@xin9le xin9le added the enhancement New feature or request label Nov 24, 2026
@xin9le
xin9le merged commit 0db3c97 into main Nov 24, 2026
2 checks passed
@xin9le
xin9le deleted the feature/NativeAOT branch November 24, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant