Add AOT Markup optimisations #4092
Merged
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.
What kind of change does this PR introduce?
Update
What is the current behavior?
AOT Markup is broadly applied
What is the new behavior?
A more detailed approach has been applied targeting methods and constructors primarily followed by class level attributes where required.
This pull request adds comprehensive support and validation for Native AOT (Ahead-of-Time) compilation in ReactiveUI, ensuring that the framework and its usage patterns work correctly in AOT scenarios. The changes include new AOT compatibility test suites, updates to package dependencies, build property enhancements for AOT, and detailed documentation of the current AOT implementation status and developer guidance.
Key highlights:
Most important changes:
AOT Test Coverage and Validation
AOTCompatibilityTests.cs
andAdvancedAOTTests.cs
to theReactiveUI.AOTTests
project, providing extensive test coverage for ReactiveUI features under Native AOT, including property changes, commands, property helpers, routing, validation, activation, dependency resolution, and message bus scenarios. Tests useUnconditionalSuppressMessage
where required, following best practices to keep production code clean. [1] [2]Build and Project System Enhancements
Directory.build.props
to set<IsAotCompatible>true>
for all non-test projects targeting .NET 8.0 or 9.0, ensuring the build system recognizes and optimizes for AOT scenarios.Dependency Updates for Compatibility
Directory.Packages.props
for improved compatibility and stability, includingSplat
,System.Text.Json
, andMicrosoft.AspNetCore.Components
. Also addedMicrosoft.Windows.CsWinRT
as a new dependency. [1] [2] [3] [4]These changes collectively aim to ensure that ReactiveUI is fully ready for Native AOT compilation, with clear guidance and validation for developers targeting modern .NET platforms.
What might this PR break?
AOT Trimming may be affected
Please check if the PR fulfills these requirements
Other information: