[TrimmableTypeMap] Remove ForceUnconditionalEntries workaround#11345
Draft
simonrozsival wants to merge 3 commits into
Draft
[TrimmableTypeMap] Remove ForceUnconditionalEntries workaround#11345simonrozsival wants to merge 3 commits into
simonrozsival wants to merge 3 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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); |
…e name collision - Replace [DynamicDependency] attributes on FindX509TrustManager with a HackToPreserveInvokers method using [MethodImpl(NoInlining)] to prevent the linker from trimming IX509TrustManagerInvoker and X509ExtendedTrustManagerInvoker. - Remove obsolete API 21-23 Conscrypt TrustManagerImpl workaround. - Rename generated enum from AppFunctionState to AppFunctionEnabledState to avoid name collision with the new Android API 37 android.app.appfunctions.AppFunctionState class. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Remove the
ForceUnconditionalEntriesworkaround from the trimmable typemapModelBuilder. This was a temporary workaround for dotnet/runtime#127004 that forced allTypeMapentries to be emitted as 2-arg (unconditional), preventing unused framework bindings from being trimmed.Changes
ForceUnconditionalEntriesconstant and all conditional logic gated on itTypeMapAttributeentries for non-essential MCW bindings[DynamicDependency]attributes onFindX509TrustManagerwith aHackToPreserveInvokersmethod using[MethodImpl(NoInlining)]to prevent the linker from trimmingIX509TrustManagerInvokerandX509ExtendedTrustManagerInvokerTrustManagerImplworkaround (min API is now higher)AppFunctionStatetoAppFunctionEnabledStateto fix name collision with the new Android API 37android.app.appfunctions.AppFunctionStateclassValidation
Mono.Android.NET-Testspassed on device (0 failures, 18 expected ignores)ServerCertificateCustomValidationCallback_*tests pass