Repository navigation
[release/11.0.1xx] [UIKit] Fix UIScreenEdgePanGestureRecognizer(Action<UIScreenEdgePanGestureRecognizer>) constructor. Fixes #27066 - #27392
Open
rolfbjarne wants to merge 1 commit into
Conversation
…estureRecognizer>)` constructor. Fixes #27066 (#27079) `UIPanGestureRecognizer`'s internal constructor (IntPtr sel, Token token) was passing (token, sel) to its base constructor instead of (sel, token), resolving to `UIGestureRecognizer(NSObject, IntPtr)` instead of `UIGestureRecognizer(IntPtr, Token)`. As a result, the callback token for `UIScreenEdgePanGestureRecognizer(Action<T>)` was never stored in the recognizers dictionary or marked dirty, allowing it to be garbage collected before the gesture action could be invoked. Fixes #27066 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the constructor callback-retention fix.
No open issues 🎉
What changed in this PR
Backports #27079 to release/11.0.1xx, fixing the typed UIScreenEdgePanGestureRecognizer constructor so its callback remains registered and survives garbage collection. Addresses #27066.
Changes:
- Corrects constructor argument order to use the managed callback-registration path.
- Adds a regression test, excluded on tvOS, that checks target registration and callback delivery after garbage collection.
| File | Description |
|---|---|
tests/monotouch-test/UIKit/GestureRecognizerTest.cs |
Adds regression coverage for the screen-edge pan callback constructor. |
src/UIKit/UIGestureRecognizer.cs |
Fixes base-constructor forwarding to retain the callback token and mark the recognizer dirty. |
Review effort: Balanced
dalexsoto
approved these changes
Nov 19, 2026
This branch has not been deployed
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.
UIPanGestureRecognizer's internal constructor (IntPtr sel, Token token) waspassing (token, sel) to its base constructor instead of (sel, token), resolving
to
UIGestureRecognizer(NSObject, IntPtr)instead ofUIGestureRecognizer(IntPtr, Token).As a result, the callback token for
UIScreenEdgePanGestureRecognizer(Action<T>)was never stored in the recognizers dictionary or marked dirty, allowing it to
be garbage collected before the gesture action could be invoked.
Fixes #27066
🤖 Pull request created by Copilot
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com
Co-authored-by: Rolf Bjarne Kvinge rokvin@microsoft.com
Backport of #27079.