Skip to content

[iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime - #38551

Merged
kubaflo merged 3 commits into
dotnet:inflight/currentfrom
SuthiYuvaraj:Fix-38291
Sep 21, 2026
Merged

kubaflo merged 3 commits into
dotnet:inflight/currentfrom
SuthiYuvaraj:Fix-38291

Conversation

@SuthiYuvaraj

@SuthiYuvaraj SuthiYuvaraj commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

RootCause:

In GesturePlatformManager.iOS.cs, the native UITapGestureRecognizer is created once in CreateTapRecognizer with the NumberOfTapsRequired value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.)

Fix Description:

Mirrored the existing OnSwipeGestureRecognizerPropertyChanged pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native UITapGestureRecognizer instances in _gestureRecognizers and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer.

Issues Fixed

Fixes #38291

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before Issue Fix After Issue Fix
Screen.Recording.2026-09-16.at.9.29.06.AM.mov
Screen.Recording.2026-09-16.at.9.24.08.AM.mov

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38551

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38551"

@SuthiYuvaraj SuthiYuvaraj changed the title [iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime [WIP] [iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime Sep 15, 2026
@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Sep 15, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 15, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 2 findings

See inline comments for details.

MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Sep 15, 2026
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Warning

Your /review couldn't start: the pipeline branch improved-reviewer doesn't exist. Use --branch improved-reviewer (the current reviewer branch), or omit --branch to run on main. Valid platforms: android, ios, catalyst, windows (e.g. /review android --branch improved-reviewer).

@github-actions github-actions Bot removed the s/agent-review-in-progress AI review is currently running for this PR label Sep 18, 2026
@SuthiYuvaraj SuthiYuvaraj changed the title [WIP] [iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime [iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime Sep 18, 2026
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 18, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review September 21, 2026 10:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Note

🔍 /review started

AzDO build 15396554 is running for ios.

The s/agent-review-in-progress label stays on this PR while the run is active. The final recommendation and outcome labels are posted only after Gate, expert review, and Deep UI tests finish.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@SuthiYuvaraj — new AI review results are available based on commit 16865a8.

Gate Inconclusive Confidence Medium Platform iOS


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ⚠️ INCONCLUSIVE

Platform: IOS · Base: main · Merge base: c97874ce

🩺 Could not verify — environment/infrastructure error. The gate ran the tests but hit an environment error (an emulator/simulator/Appium/XHarness flake, a device that would not boot, or an empty/invalid result file), so it could not record a real pass/fail. The ⚠️ ENV ERROR marks below are infrastructure, not test failures — this is not a problem with your PR. Comment /review to retry on a fresh agent.

XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.GestureTests' (the target tests did not run).

Test Without Fix (expect FAIL) With Fix (expect PASS)
📱 GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan) Category=Gesture ⚠️ ENV ERROR ⚠️ ENV ERROR
🔴 Without fix — 📱 GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan): ⚠️ ENV ERROR · 161s

No log file found

🟢 With fix — 📱 GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan): ⚠️ ENV ERROR · 65s

No log file found

⚠️ Failure Details

  • ⚠️ GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan) without fix: XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.GestureTests' (the target tests did not run).
  • ⚠️ GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan) with fix: XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.GestureTests' (the target tests did not run).
📁 Fix files reverted (1 files)
  • src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs

📋 Pre-Flight — Context & Validation

Issue: #38291 - [iOS/MacCatalyst] TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime
PR: #38551 - [iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime
Platforms Affected: iOS and MacCatalyst (STEP 5a testing platform: iOS)
Files Changed: 1 implementation, 1 device-test

Problem Context

  • GesturePlatformManager.CreateTapRecognizer copies TapGestureRecognizer.NumberOfTapsRequired into a UITapGestureRecognizer only when the native recognizer is created.
  • Changing the managed property later leaves the live UIKit recognizer at its original tap count, so the issue's double-tap-to-single-tap scenario continues to require two taps.
  • Direct recognizers are dictionary keys themselves; formatted Span gestures are represented by ChildGestureRecognizer keys wrapping the managed TapGestureRecognizer.

PR Approach

  • Extend OnTapGestureRecognizerPropertyChanged to react to NumberOfTapsRequiredProperty.
  • Scan _gestureRecognizers, resolve either a direct TapGestureRecognizer or the recognizer wrapped by ChildGestureRecognizer, and update every matching UITapGestureRecognizer.NumberOfTapsRequired in place.
  • Add ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan, covering transitions 1→2, 2→3, 3→1, and 1→3.

Review and Gate Context

  • An earlier inline review found that the initial implementation only handled direct dictionary keys and that its test did not cover the ChildGestureRecognizer path. The current PR revision addresses both points.
  • The current gate is INCONCLUSIVE, not failing: XHarness did not produce a fresh testResults.xml, so the requested test did not run. This must not be treated as evidence against the PR fix.
  • Per the STEP 5a contract, no standalone expert-review agent was run during pre-flight.

Bounded Test Command

pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Gesture"

This is the detected targeted Controls device-test category. It includes the primary regression ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan and the existing Gesture-category regressions; no broader suite is authorized.

Changed Files

  • src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
  • src/Controls/tests/DeviceTests/GestureTests.iOS.cs

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #38551 Update matching live native tap recognizers in place by scanning the dictionary and resolving direct or child wrappers ⚠️ INCONCLUSIVE (gate environment error) 2 Current PR baseline; alternatives must use a mechanism-level different approach

🔬 Code Review — Deep Analysis

Expert PR Evaluation

Verdict: LGTM on code merits
Confidence: medium

The submitted fix updates each live iOS UITapGestureRecognizer when its corresponding TapGestureRecognizer.NumberOfTapsRequired changes. The lookup handles both direct view gestures and ChildGestureRecognizer wrappers used by Span, and it reuses the existing property-change subscription and disposal paths rather than rebuilding native recognizers.

The new iOS device test covers runtime mutation after handler creation for the reported Span path across several tap-count transitions. No concrete correctness, lifecycle, threading, or regression defect was found in the changed lines, so inline-findings.json contains an empty JSON array.

Blast radius: Localized iOS/MacCatalyst gesture plumbing; no startup path, static/shared state, or new subscription is introduced. Property updates are expected to originate from the UI-thread-bound bindable-object path, matching existing native gesture property updates in this class.

Failure-mode probes: Direct and wrapped recognizers resolve to the same managed tap recognizer; unknown/unregistered recognizers cause no native mutation; disposed managers have unsubscribed and cleared their recognizer map; reconnect creates a new manager and native recognizers with the current value. The trusted Gate is inconclusive because the tests could not be built or run, so runtime verification remains unavailable but is not treated as a test failure.


🛠️ Try-Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 gpt-5.3-codex try-fix Remove/dispose all tracked native recognizers and rebuild them from managed state whenever Buttons or NumberOfTapsRequired changes ✅ PASS 1 implementation file Fresh XHarness payload: 6 run, 6 passed, 0 failed; fresh result file confirmed
2 gpt-5.6-sol try-fix Bind each native tap recognizer directly to its resolved managed tap through a private native subclass and unsubscribe on disposal ⚠️ BLOCKED / UNVERIFIED 1 implementation file The app aborted before discovery while loading the Microsoft.Maui.Maps AOT module; Passed: 0, Failed: 0, and no fresh result XML
PR PR #38551 Scan the recognizer dictionary, resolve direct and child-wrapped taps, and mutate matching live native tap counts in place ⚠️ INCONCLUSIVE (gate environment error) 2 files Original PR

Candidate 1 — Rebuild Native Recognizers

Model: gpt-5.3-codex

Approach: On either Buttons or NumberOfTapsRequired changes, unsubscribe managed property handlers, remove and dispose all cached native recognizers, clear _gestureRecognizers, and call LoadRecognizers() to reconstruct native recognizers from current managed state.

Difference from the PR: The PR preserves the live recognizer set and updates matching UITapGestureRecognizer instances in place. Candidate 1 invalidates and recreates the complete native recognizer set.

Candidate diff:

diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
index 68393011a7..c9e3dd8b16 100644
--- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
+++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
@@ -892,8 +892,44 @@ namespace Microsoft.Maui.Controls.Platform
 
 		void OnTapGestureRecognizerPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
 		{
-			if (e.Is(TapGestureRecognizer.ButtonsProperty))
-				LoadRecognizers();
+			if (!e.Is(TapGestureRecognizer.ButtonsProperty) &&
+				!e.Is(TapGestureRecognizer.NumberOfTapsRequiredProperty))
+			{
+				return;
+			}
+
+			ReloadRecognizers();
+		}
+
+		void ReloadRecognizers()
+		{
+			foreach (var kvp in _gestureRecognizers)
+			{
+				if (TryGetTapGestureRecognizer(kvp.Key, out TapGestureRecognizer? tapGestureRecognizer) &&
+					tapGestureRecognizer != null)
+				{
+					tapGestureRecognizer.PropertyChanged -= OnTapGestureRecognizerPropertyChanged;
+				}
+
+				if (TryGetSwipeGestureRecognizer(kvp.Key, out SwipeGestureRecognizer? swipeGestureRecognizer) &&
+					swipeGestureRecognizer != null)
+				{
+					swipeGestureRecognizer.PropertyChanged -= OnSwipeGestureRecognizerPropertyChanged;
+				}
+
+				foreach (var uiGestureRecognizer in kvp.Value)
+				{
+					if (uiGestureRecognizer is null)
+						continue;
+
+					PlatformView?.RemoveGestureRecognizer(uiGestureRecognizer);
+					uiGestureRecognizer.ShouldReceiveTouch = null;
+					uiGestureRecognizer.Dispose();
+				}
+			}
+
+			_gestureRecognizers.Clear();
+			LoadRecognizers();
 		}
 
 		void OnSwipeGestureRecognizerPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)

Authorized test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Gesture"

Recorded result: PASS. The fresh XHarness payload reports Tests run: 6 Passed: 6 Inconclusive: 0 Failed: 0 Ignored: 0, reports “Application finished the test run successfully,” and confirms that /Documents/test-results.xml existed. The wrapper's later Passed: 0 / Failed: 0 display is a secondary parsing defect; it does not override the run-specific XHarness result.

Self-review: 0 findings.

Failure analysis: N/A. All six targeted Gesture test executions passed. The rebuild mechanism remains broader than the PR: every relevant tap-property change destroys and recreates all native gesture recognizers, increasing lifecycle and transient-state risk compared with updating only the affected recognizer.

Candidate 2 — Per-Native Managed-Property Synchronization

Model: gpt-5.6-sol

Approach: Construct a private UITapGestureRecognizer subclass with the already-resolved managed TapGestureRecognizer. Each native peer subscribes directly to that managed recognizer, updates only its own NumberOfTapsRequired, and removes the subscription from Dispose(bool).

Difference from the PR and candidate 1: Unlike the PR, updates do not scan or re-resolve dictionary keys. Unlike candidate 1, the design preserves all native recognizer identities and does not rebuild the recognizer set. Synchronization is established once between each managed/native pair during creation.

Candidate diff:

diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
index 68393011a7..1b8e76c86d 100644
--- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
+++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
@@ -554,9 +554,8 @@ namespace Microsoft.Maui.Controls.Platform
 				ProcessRecognizerHandlerTap(weakEventTracker, weakRecognizer, originPoint, (int)sender.NumberOfTapsRequired, sender);
 			});
 
-			var result = new UITapGestureRecognizer(action)
+			var result = new PropertySynchronizedTapGestureRecognizer(tapGesture, action)
 			{
-				NumberOfTapsRequired = (uint)tapGesture.NumberOfTapsRequired,
 				ShouldRecognizeSimultaneously = ShouldRecognizeTapsTogether
 			};
 
@@ -580,6 +579,41 @@ namespace Microsoft.Maui.Controls.Platform
 			return result;
 		}
 
+		sealed class PropertySynchronizedTapGestureRecognizer : UITapGestureRecognizer
+		{
+			TapGestureRecognizer? _tapGestureRecognizer;
+
+			public PropertySynchronizedTapGestureRecognizer(
+				TapGestureRecognizer tapGestureRecognizer,
+				Action<UITapGestureRecognizer> action)
+				: base(action)
+			{
+				_tapGestureRecognizer = tapGestureRecognizer;
+				NumberOfTapsRequired = (uint)tapGestureRecognizer.NumberOfTapsRequired;
+				tapGestureRecognizer.PropertyChanged += OnTapGestureRecognizerPropertyChanged;
+			}
+
+			void OnTapGestureRecognizerPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+			{
+				if (e.Is(TapGestureRecognizer.NumberOfTapsRequiredProperty) &&
+					sender is TapGestureRecognizer tapGestureRecognizer)
+				{
+					NumberOfTapsRequired = (uint)tapGestureRecognizer.NumberOfTapsRequired;
+				}
+			}
+
+			protected override void Dispose(bool disposing)
+			{
+				if (disposing && _tapGestureRecognizer is not null)
+				{
+					_tapGestureRecognizer.PropertyChanged -= OnTapGestureRecognizerPropertyChanged;
+					_tapGestureRecognizer = null;
+				}
+
+				base.Dispose(disposing);
+			}
+		}
+
 		static bool ShouldRecognizeTapsTogether(UIGestureRecognizer gesture, UIGestureRecognizer other)
 		{
 			// If multiple tap gestures are potentially firing (because multiple tap gesture recognizers have been

Authorized test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Gesture"

Recorded result: BLOCKED / UNVERIFIED. The fresh run counted Passed: 0, Failed: 0. The simulator app aborted before test discovery with Failed to load AOT module 'Microsoft.Maui.Maps', XHarness did not connect to the test protocol, and no fresh test-results.xml was copied after four attempts. Six results visible in a reused system log predated this attempt and were correctly excluded as stale.

Self-review: 0 findings.

Failure analysis: Candidate behavior never executed. No correction/retest was justified because the failure occurred in AOT dependency loading before discovery and outside the allowed gesture-source boundary.

Cross-Pollination

Omitted by the STEP 5a hard execution contract.

Selection

Exhausted: Yes — the hard contract permits exactly these two sequential attempts and no follow-up agents.

Selected Fix: Candidate 1. It is the only alternative with empirical validation: the fresh iOS XHarness run executed six targeted Gesture tests and passed all six. Candidate 2 is more targeted but remains blocked before discovery. Candidate 1 is broader than the PR and recreates unrelated native recognizer state, so the PR may still be preferable on minimality and lifecycle risk once equivalently validated; under the try-fix rule that only passing candidates qualify, however, candidate 1 is the bounded winner.


🏁 Report — Final Recommendation

✅ Final Recommendation: APPROVE

Winner: pr

The submitted PR is the strongest implementation: it updates only the affected live UITapGestureRecognizer instances, preserves native recognizer identity and unrelated gesture state, handles both direct gestures and ChildGestureRecognizer-wrapped Span gestures, and adds focused regression coverage. The single expert review found no actionable correctness, lifecycle, threading, or regression issue.

Comparative ranking

Rank Candidate Validation evidence Assessment
1 pr ⚠️ INCONCLUSIVE — the trusted gate was blocked by XHarness/result-file infrastructure before the tests ran Best balance of correctness, scope, and lifecycle safety. The in-place update is narrowly limited to native peers for the changed managed recognizer.
1 (equivalent) pr-plus-reviewer ⚠️ INCONCLUSIVE — no reviewer patch was warranted, so it has the same evidence as pr Byte-for-byte behaviorally identical to pr. The raw PR wins the tie because this candidate contributes no refinement.
2 try-fix-1 ✅ PASS — fresh XHarness run reported 6/6 Gesture tests passing Empirically verified, but substantially broader: one tap-property change removes, disposes, and rebuilds every tracked native recognizer. That can reset unrelated native recognizer identity/state and increases lifecycle risk beyond what the bug requires.
3 try-fix-2 ⚠️ BLOCKED / UNVERIFIED — app aborted before discovery while loading the Microsoft.Maui.Maps AOT module; 0 tests ran Focused per-native synchronization, but introduces a custom native subclass and an additional managed-property subscription/disposal obligation. It is more complex than the PR and has no execution evidence.

No candidate failed a regression test, so the rule placing failed candidates below passing candidates does not alter this ordering. try-fix-1 has the strongest runtime evidence, but its six passing targeted tests do not cover the broader lifecycle and recognizer-state risks introduced by rebuilding the complete set.

Why pr wins

  • Correctness: The property callback resolves both dictionary key shapes and updates all matching native tap recognizers, including repeated wrappers around the same managed recognizer.
  • Lifecycle safety: It adds no subscriptions, retained references, native subclasses, disposal paths, or recognizer reconstruction.
  • Regression containment: It leaves unrelated gestures, active UIKit state, interactions, and native recognizer identity untouched.
  • Coverage: The submitted test exercises the harder Span/ChildGestureRecognizer path after handler creation across four tap-count transitions.
  • Expert result: inline-findings.json is []; the expert verdict was LGTM with medium confidence because this is platform-specific UI plumbing.

The trusted gate is inconclusive solely because its environment did not produce a fresh result file, and its report explicitly classifies that as infrastructure rather than a PR failure. Under the supplied instruction not to request changes solely for that blocker, it does not veto approval on code merits; runtime verification uncertainty remains recorded rather than being misreported as a pass.


📱 UI Tests — Button,Label,Layout

Detected UI test categories: Button,Label,Layout

✅ Deep UI tests — 415 passed, 0 failed, 8 skipped across 3 categories on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
Button 105/106 (1 skipped) ✓ —
Label 113/115 (2 skipped) ✓ —
Layout 197/202 (5 skipped) ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

🧭 Next Steps — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@MauiBot MauiBot added s/agent-approved AI agent recommends approval - PR fix is correct and optimal and removed s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-review-in-progress AI review is currently running for this PR labels Sep 21, 2026
@kubaflo
kubaflo changed the base branch from main to inflight/current September 21, 2026 17:39
@kubaflo
kubaflo merged commit 1aa4552 into dotnet:inflight/current Sep 21, 2026
182 of 198 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Sep 21, 2026
kubaflo pushed a commit that referenced this pull request Sep 27, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Sep 27, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
@sheiksyedm sheiksyedm added the community ✨ Community Contribution label Oct 1, 2026
kubaflo pushed a commit that referenced this pull request Oct 3, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 3, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 6, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 6, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 13, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 13, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 14, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 14, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 18, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
kubaflo pushed a commit that referenced this pull request Oct 18, 2026
…s not reactive at runtime (#38551)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### RootCause: 

In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer`
is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired`
value snapshotted at creation time. The PropertyChanged handler
OnTapGestureRecognizerPropertyChanged only reacted to
TapGestureRecognizer.ButtonsProperty changes (triggering
LoadRecognizers()), so changing NumberOfTapsRequired at runtime never
propagated to the native recognizer. (Android already reads
NumberOfTapsRequired dynamically on each tap via a predicate filter, so
it wasn't affected.)
 
### Fix Description:

Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern
— when NumberOfTapsRequiredProperty changes, look up the already-created
native `UITapGestureRecognizer` instances in `_gestureRecognizers` and
update NumberOfTapsRequired directly, since UIKit allows changing this
property on a live recognizer.

### Issues Fixed
Fixes #38291 

### Tested the behaviour in the following platforms
- [ ] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Output Screenshot
Before Issue Fix | After Issue Fix |
|----------|----------|
|<video width="100" height="100" alt="Before Fix"
src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video
width="100" height="100" alt="After Fix"
src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-gestures Gesture types community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS/MacCatalyst] TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime

5 participants