Repository navigation
Add Native AOT compatibility - #5156
Merged
Denis Voituron (dvoituron) merged 6 commits intoAug 17, 2026
Merged
Conversation
James Newton-King (JamesNK)
requested review from
Denis Voituron (dvoituron) and
Vincent Baaij (vnbaaij)
as code owners
August 17, 2026 03:42
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Native AOT compatibility declarations and removes AOT-unfriendly patterns across Fluent UI Blazor’s Core, Icons, and Emoji packages, primarily by replacing runtime generic reflection and by switching theme JSON (de)serialization to source-generated System.Text.Json metadata.
Changes:
- Declares
IsAotCompatibleon shipped Core/Icons/Emoji assemblies and expands CI to build the Icons/Emoji package graphs with warnings-as-errors. - Replaces reflection-based formatting in
PropertyColumnand reflection-basedFieldIdentifier.Createinvocation inFluentField. - Introduces a source-generated
JsonSerializerContextfor theme dictionary JSON round-tripping, and updates theme (de)serialization to use it.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj | Marks the Core components assembly as AOT-compatible. |
| src/Core/Components/Theme/Styles/ThemeJsonSerializerContext.cs | Adds source-generated JSON metadata context for theme dictionary serialization. |
| src/Core/Components/Theme/Styles/ThemeExtensions.cs | Switches Theme JSON (de)serialization to the source-generated context. |
| src/Core/Components/Icons/IconsExtensions.cs | Uses AOT-safe enum enumeration and assembly-name matching for icon discovery/loading. |
| src/Core/Components/Field/FluentField.razor.cs | Removes reflection-based FieldIdentifier.Create invocation and replaces it with expression parsing. |
| src/Core/Components/Emojis/EmojiExtensions.cs | Uses assembly-name matching via AssemblyName.Name for emoji discovery/loading. |
| src/Core/Components/DataGrid/Columns/PropertyColumn.cs | Replaces runtime generic reflection formatter creation with an interface-based formatter path. |
| src/Assets/FluentUI.Icons/Icons/Regular/Icons.Regular.csproj | Marks Icons.Regular as AOT-compatible. |
| src/Assets/FluentUI.Icons/Icons/Light/Icons.Light.csproj | Marks Icons.Light as AOT-compatible. |
| src/Assets/FluentUI.Icons/Icons/Filled/Icons.Filled.csproj | Marks Icons.Filled as AOT-compatible. |
| src/Assets/FluentUI.Icons/Icons/Color/Icons.Color.csproj | Marks Icons.Color as AOT-compatible. |
| src/Assets/FluentUI.Icons/Components.Icons.Package.csproj | Marks the Icons package graph root as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/TravelPlaces/Emoji.TravelPlaces.csproj | Marks Emojis.TravelPlaces as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/Symbols/Emoji.Symbols.csproj | Marks Emojis.Symbols as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/SmileysEmotion/Emoji.SmileysEmotion.csproj | Marks Emojis.SmileysEmotion as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/PeopleBody/Emoji.PeopleBody.csproj | Marks Emojis.PeopleBody as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/Objects/Emoji.Objects.csproj | Marks Emojis.Objects as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/FoodDrink/Emoji.FoodDrink.csproj | Marks Emojis.FoodDrink as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/Flags/Emoji.Flags.csproj | Marks Emojis.Flags as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/AnimalsNature/Emoji.AnimalsNature.csproj | Marks Emojis.AnimalsNature as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Emojis/Activities/Emoji.Activities.csproj | Marks Emojis.Activities as AOT-compatible. |
| src/Assets/FluentUI.Emojis/Components.Emoji.Package.csproj | Marks the Emoji package graph root as AOT-compatible. |
| .github/workflows/build-core-lib.yml | Adds Icons/Emoji package graph builds to the existing warning-as-error workflow. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Denis Voituron (dvoituron)
approved these changes
Aug 17, 2026
Denis Voituron (dvoituron)
enabled auto-merge (squash)
August 17, 2026 07:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
📖 Description
Adds Native AOT compatibility declarations and removes unannotated trimming, single-file, and AOT analyzer warnings from the core Components package and the Icons and Emoji package graphs.
The core changes:
PropertyColumnformatting andFluentFieldfield identifier creation.System.Text.Jsonmetadata for theme serialization and deserialization.IsAotCompatibleon every shipped Core, Icons, and Emoji assembly.The reflection-based
GetInstanceandGetAll*asset discovery APIs retain their existingRequiresUnreferencedCodecontracts. Direct references to generated icon and emoji types are AOT-safe.🎫 Issues
None.
👩💻 Reviewer Notes
The main review areas are the formatter behavior in
PropertyColumn, expression parsing inFluentField, and preservation of the flat theme JSON wire format through source generation.📑 Test Plan
dotnet test tests/Core/Components.Tests.csproj --configuration Debug --no-restore --no-builddotnet build src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj --configuration Release -warnaserrornet8.0,net9.0, andnet10.0; 0 warnings, 0 errorsdotnet build src/Assets/FluentUI.Icons/Components.Icons.Package.csproj --configuration Debugdotnet build src/Assets/FluentUI.Emojis/Components.Emoji.Package.csproj --configuration Debugwin-x64Native AOT executable with warnings as errors. It successfully usedFluentButton, concrete generated Icon and Emoji types, and a Theme JSON round trip.✅ Checklist
General
Component-specific
⏭ Next Steps
None.