Skip to content

[release/11.0.1xx] [UIKit] Fix UIScreenEdgePanGestureRecognizer(Action<UIScreenEdgePanGestureRecognizer>) constructor. Fixes #27066 - #27392

Open
rolfbjarne wants to merge 1 commit into
release/11.0.1xxfrom
dev/rolf/backport-pr-27079-release/11.0.1xx-2026-11-19
Open

rolfbjarne wants to merge 1 commit into
release/11.0.1xxfrom
dev/rolf/backport-pr-27079-release/11.0.1xx-2026-11-19

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

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

Backport of #27079.

…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>
@rolfbjarne rolfbjarne added ready-to-review This PR is ready to review/merge. backported labels Nov 19, 2026
Copilot AI balanced review requested due to automatic review settings November 19, 2026 09:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants