[VALIDATION ONLY - DO NOT MERGE] Validate removing the TypeMap proxy-attribute workaround on .NET 11#26019
[VALIDATION ONLY - DO NOT MERGE] Validate removing the TypeMap proxy-attribute workaround on .NET 11#26019rolfbjarne wants to merge 2 commits into
Conversation
…0 only The workaround for dotnet/runtime#127004 (adding the proxy type's attribute to the source type so ILLink's TypeMapHandler keeps the TypeMapAssociation) is no longer needed once the ILLink fix is available. The fix is only present in .NET 11+, so keep the workaround for .NET 10 and only stop applying it for .NET 11+: * In TrimmableRegistrarStep, only add the proxy attribute to the source type when targeting .NET 10 or earlier. * In TypeMaps (runtime), only read the workaround attribute from the source type for .NET 10 or earlier (gated with !NET11_0_OR_GREATER). Fixes #25276. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
❌ [CI Build #83cff3f] Prepare .NET Release failed ❌The following jobs reported a non-successful result:
Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build #d255353] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 8 tests failed, 225 tests passed. Failures❌ dotnettests tests (iOS) [attempt 2]1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (MacCatalyst) [attempt 2]1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (macOS) [attempt 2]1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS) [attempt 2]2 tests failed, 21 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (MacCatalyst) [attempt 2]2 tests failed, 21 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (macOS) [attempt 2]1 tests failed, 17 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (tvOS)🔥 Failed catastrophically on VSTS: test results - monotouch_tvos (no summary found). Html Report (VSDrops) Download Successes✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
…indClass
When looking up the Objective-C class for a managed type, the trimmable
static registrar's FindClass looked up the *closed* generic type (e.g.
UIGestureRecognizer.Callback<UITapGestureRecognizer>) in the type maps.
However, generic types are registered using their generic type definition
(the maps are keyed by the *open* generic type, e.g. Callback`1), so the
lookup failed and the runtime tried to fall back to the dynamic registrar
(which has been linked away), throwing MT8026:
Can't register the class UIKit.UIGestureRecognizer+Callback`1[[UIKit.UITapGestureRecognizer, ...]] when the dynamic registrar has been linked away.
This was previously masked by the workaround for
dotnet/runtime#127004: reading the proxy attribute
directly off the closed generic type (Type.GetCustomAttribute) returns the
attribute stamped on the open generic definition, so the lookup happened to
succeed. Once that workaround was gated off for .NET 11+ (commit
d255353), the missing generic-type-definition reduction was exposed,
causing MT8026 (and, depending on timing, a NullReferenceException in
UIGestureRecognizer.OnDispose during finalization of an uninitialized
UITapGestureRecognizer).
Mirror the reduction already done in the non-trimmable FindClass path
(which does `if (type.IsGenericType) type = type.GetGenericTypeDefinition ()`).
Verified with:
make build run-bare -C tests/monotouch-test/dotnet/MacCatalyst \
TEST_VARIATION='trimmable-static-registrar-all-optimizations-linkall|release' CONFIG=Release \
RUN_ARGUMENTS="--test=MonoTouchFixtures.UIKit.GestureRecognizerTest.GenericCallbackTest"
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 22caaaa0-7267-4c5e-8c22-58e5b04e9f42
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This PR is for validation only and must not be merged.
It cherry-picks the change from #26018 onto
net11.0. Onnet11.0, the gating(
TargetFramework.Version.Major <= 10in the linker and!NET11_0_OR_GREATERin the runtime) disables the workaround for dotnet/runtime#127004,
so this PR exercises the code path where the workaround is removed and the
ILLink fix (present in .NET 11) is relied upon instead.
The purpose is to confirm via CI that the TypeMap proxy associations are still
kept without the workaround on .NET 11.
Related issue: #25276
Real PR (targets main): #26018
🤖 Pull request created by Copilot