We have a workaround in tools/dotnet-linker/Steps/TrimmableRegistrarStep.cs for a bug in ILLink's TypeMapHandler (dotnet/runtime#127004).
What the workaround does
When creating TypeMapAssociation entries, we add the proxy type's NSObjectProxyAttribute (or protocol equivalent) as a custom attribute on the source type as well (not just on the proxy type itself). This ensures the linker keeps the TypeMapAssociation when the external TypeMap preserves the source type.
Code to remove
In tools/dotnet-linker/Steps/TrimmableRegistrarStep.cs, remove the two addPostAction blocks with the comment referencing dotnet/runtime/issues/127004:
- Around line 469-473 (NSObject proxy case)
- Around line 560-564 (Protocol proxy case)
Validation
Run the TypeMap-related tests with full trimming to ensure proxy associations are still kept without the workaround:
cd tests/monotouch-test/dotnet/MacCatalyst
make build run-bare TEST_VARIATION='release|trimmable-static-registrar-all-optimizations-linkall' RUN_ARGUMENTS="--test MonoTouchFixtures.CategoryTest.Static"
Upstream issue: dotnet/runtime#127004
Upstream fix: dotnet/runtime#127005
We have a workaround in
tools/dotnet-linker/Steps/TrimmableRegistrarStep.csfor a bug in ILLink's TypeMapHandler (dotnet/runtime#127004).What the workaround does
When creating TypeMapAssociation entries, we add the proxy type's
NSObjectProxyAttribute(or protocol equivalent) as a custom attribute on the source type as well (not just on the proxy type itself). This ensures the linker keeps the TypeMapAssociation when the external TypeMap preserves the source type.Code to remove
In
tools/dotnet-linker/Steps/TrimmableRegistrarStep.cs, remove the twoaddPostActionblocks with the comment referencingdotnet/runtime/issues/127004:Validation
Run the TypeMap-related tests with full trimming to ensure proxy associations are still kept without the workaround:
Upstream issue: dotnet/runtime#127004
Upstream fix: dotnet/runtime#127005