Skip to content

[TrimmableTypeMap] Remove ForceUnconditionalEntries workaround#11345

Open
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/remove-forceunconditionalentries
Open

[TrimmableTypeMap] Remove ForceUnconditionalEntries workaround#11345
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/remove-forceunconditionalentries

Conversation

@simonrozsival
Copy link
Copy Markdown
Member

Summary

  • remove the ForceUnconditionalEntries workaround from ModelBuilder
  • restore 3-arg conditional TypeMapAttribute entries for non-essential MCW bindings
  • keep essential runtime types and user ACWs as 2-arg unconditional entries
  • update model and PE blob tests for the restored conditional behavior

Validation

  • dotnet test tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests.csproj --no-restore --nologo
  • ./build.sh Prepare
  • dotnet test tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests.csproj --no-restore --nologo -p:JavaPath="$JAVA_HOME/bin/java" -p:JavaCPath="$JAVA_HOME/bin/javac" -p:JarPath="$JAVA_HOME/bin/jar"
  • ./build.sh Build && ./build.sh Pack
  • ./dotnet-local.sh workload restore tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj

Attempted runtime/device validation with Mono.Android.NET-Tests.csproj -t:RunTestApp -p:_AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=false; it was blocked before install/run by existing Java.Interop-Tests.NET compile errors in external/Java.Interop (JniTypeUtf8Test span/string API mismatches and missing JniNativeMethod).

Restore conditional TypeMap entries for non-essential MCW bindings now that the runtime trimmer issue has been fixed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 08:56
@simonrozsival simonrozsival added copilot `copilot-cli` or other AIs were used to author this trimmable-type-map labels May 14, 2026
@simonrozsival simonrozsival changed the title Remove ForceUnconditionalEntries workaround [TrimmableTypeMap] Remove ForceUnconditionalEntries workaround May 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the ForceUnconditionalEntries workaround from trimmable typemap model generation, restoring conditional 3-arg TypeMapAttribute emission for non-essential MCW bindings while keeping essential runtime/user ACW entries unconditional.

Changes:

  • Removes the global force-unconditional switch from ModelBuilder.
  • Restores conditional target references for non-essential MCW entries.
  • Updates model and PE blob tests to expect restored 3-arg behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ModelBuilder.cs Removes workaround logic and reverts unconditional decisions to IsUnconditionalEntry() plus alias-specific rules.
tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/TypeMapModelBuilderTests.cs Updates assertions and test names/comments for restored conditional MCW typemap entries.

Comment on lines +185 to 186
bool aliasBaseUnconditional = EssentialRuntimeTypes.Contains (jniName)
|| peersForName.Any (IsUnconditionalEntry);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot `copilot-cli` or other AIs were used to author this trimmable-type-map

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants