Repository navigation
[build] Use trimmable typemaps when PublishAot is enabled - #12419
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecfa1706-25e7-415f-a03e-af27f65164fc
Remove the broader runtime-selection changes and make PublishAot alone select the trimmable typemap implementation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecfa1706-25e7-415f-a03e-af27f65164fc
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns .NET for Android’s PublishAot=true behavior with the .NET SDK: Debug builds keep AOT analyzers/trimming settings but run on CoreCLR, while Release builds and publish operations continue to use NativeAOT. It also updates the default typemap selection to match the runtime choice and ensures per-RID inner builds receive the relevant native-compilation setting.
Changes:
- Update runtime selection so
PublishAot=truechooses NativeAOT only for Release or publish builds; Debug uses CoreCLR. - Change default
AndroidTypeMapImplementationdefaults (CoreCLR/NativeAOT →trimmable, MonoVM →llvm-ir) and add a DebugPublishAottest. - Propagate
NativeCompilationDuringPublishinto the per-RID inner build and document the updated runtime/typemap behavior.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/TrimmableTypeMapBuildTests.cs | Updates typemap default test and adds a Debug PublishAot behavior test. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets | Adjusts _AndroidRuntime selection logic and runtime-based typemap defaults; sets NativeCompilationDuringPublish for Debug PublishAot. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets | Forwards NativeCompilationDuringPublish into per-RID inner builds via AdditionalProperties. |
| Documentation/docs-mobile/building-apps/build-properties.md | Updates docs for typemap defaults and UseMonoRuntime vs PublishAot runtime selection behavior. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecfa1706-25e7-415f-a03e-af27f65164fc
Keep NativeCompilationDuringPublish disabled for CoreCLR inner-loop builds and cover the PublishAot Debug trimmable typemap path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ce335541-30db-4fd1-8799-24078022b70c
Remove the unrelated CoreCLR NativeCompilationDuringPublish default and set it only in the regression test so the test covers typemap selection without invoking ILC. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ce335541-30db-4fd1-8799-24078022b70c
Member
Author
|
I think this must be a flaky test/intermittent bug that's in main and it's very likely not caused by this PR. |
Member
Author
|
|
jonathanpeppers
approved these changes
Aug 19, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #12406
Summary
AndroidTypeMapImplementationtotrimmablewhenPublishAotistrue.PublishAot-based typemap default.Explicit
AndroidTypeMapImplementationvalues remain unchanged.