Repository navigation
[UIKit] Preserve trait registration token identity during disposal. - #27447
Conversation
Pass the returned managed token to UnregisterForTraitChanges so overrides that track tokens by object identity can unregister it. Add a regression test that checks callback removal and repeated disposal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change preserving trait-registration token identity during disposal.
No open issues 🎉
What changed in this PR
Preserves managed trait-registration token identity during disposal, allowing identity-sensitive UIKit overrides to recognize and unregister the original token.
Changes:
- Passes the returned managed token to
UnregisterForTraitChangesduring disposal. - Adds a regression test covering token identity, callback removal, and repeated disposal.
| File | Description |
|---|---|
tests/monotouch-test/UIKit/UITraitOverrides.cs |
Adds identity-sensitive disposal regression coverage. |
src/UIKit/UITraitChangeObservable.cs |
Passes the original managed token when unregistering during disposal. |
Review effort: Balanced
✅ 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 |
🔥 [CI Build #b14a8c7] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 1 tests failed, 195 tests passed. Failures❌ assembly-processing tests🔥 Failed catastrophically on VSTS: test results - assembly-processing (no summary found). Html Report (VSDrops) Download ❌ msbuild tests1 tests failed, 1 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ cecil: 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 |
🔥 [CI Build #b14a8c7] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 196 tests passed. Failures❌ msbuild tests [attempt 2]1 tests failed, 1 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ assembly-processing: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
🚀 [CI Build #b14a8c7] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 197 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
…lines. (#27454) Add `[UserDelegateType]` to the trait change callbacks and all 99 other unannotated production block trampolines found by the new Cecil check. The check follows `BlockLiteral` constructor calls and verifies the annotation on the method used to calculate the block signature. Checking only delegate types passed to `GetDelegateForBlock<T>` would miss these unmanaged function-pointer callbacks. For callbacks that transform their arguments, use a delegate matching the native block signature rather than the public callback's signature. This changes metadata only, not callback implementations or public APIs. Follow-up to #26699. The separate token-identity fix is in #27447. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… during disposal. (#27468) Pass the returned managed token to UnregisterForTraitChanges so overrides that track tokens by object identity can unregister it. Add a regression test that checks callback removal and repeated disposal. This is a follow-up PR to #26699. ---- 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Backport of #27447. --------- Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>
Pass the returned managed token to UnregisterForTraitChanges so overrides that track tokens by object identity can unregister it. Add a regression test that checks callback removal and repeated disposal.
This is a follow-up PR to #26699.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
b14a8c7248501bbdecf35896bbe55c7af5bcf129↑ Two independent model reviews found no errors or warnings.
↓ iOS and tvOS were not run.
🤖 Pull request created by Copilot