Repository navigation
[iOS/Mac] Fix UI becoming unresponsive when adding many Entry/Editor children to AbsoluteLayout - #36671
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36671Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36671" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR targets an iOS/MacCatalyst performance regression where adding many Entry/Editor children (notably Editor/UITextView) can freeze the UI due to repeated managed↔native marshaling of UIView.Interactions during gesture/tooltip setup.
Changes:
- Cache
UIView.Interactionsinto a local variable in tooltip resolution to avoid repeated native array marshaling. - Cache
PlatformView.Interactionsinto a local variable in the gesture platform manager cleanup loop to avoid repeated marshaling. - Add a HostApp repro page + Appium UI test to guard against the UI-freeze regression when adding 200 Editors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Core/src/Platform/iOS/ViewExtensions.cs | Caches Interactions during tooltip lookup to avoid repeated interop marshaling. |
| src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs | Caches Interactions during interaction cleanup to avoid repeated interop marshaling. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue34396.cs | Adds a repro page that adds 200 Editors to an AbsoluteLayout and reports elapsed time. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34396.cs | Adds an Appium test asserting the “add many Editors” scenario completes and the UI remains responsive. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 1 findings
See inline comments for details.
| var status = App.FindElement("StatusLabel34396").GetText() ?? string.Empty; | ||
| var elapsedMs = long.Parse(status.Replace("Completed:", string.Empty, StringComparison.Ordinal).Trim(), CultureInfo.InvariantCulture); | ||
|
|
||
| Assert.That(elapsedMs, Is.LessThan(10000), |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
❌ Regression test gap — The supplied gate result shows this assertion still passes without the fix, so the test does not reproduce #34396 or protect the cached-Interactions hot path from regressing. Please tighten the repro (for example, increase the workload or lower/structure the threshold so it fails on the base commit) before relying on this as the regression test.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
AI Review Summary
🗂️ Review Sessions — click to expand🚦 Gate — Test Before & After FixGate Result: ❌ FAILEDPlatform: IOS · Base: main · Merge base: 🩺 Test does not reproduce the bug — ran the same in both states (PASS without fix, PASS with fix). The repro test is not exercising the issue. Strengthen the test before reviewing the fix.
🔴 Without fix — 🖥️ Issue34396: PASS ❌ · 740s(no coded error found; showing last 1200 chars) 🟢 With fix — 🖥️ Issue34396: PASS ✅ · 143s(no coded error found; showing last 1200 chars)
|
| Category | Tests | Snapshot diffs |
|---|---|---|
Editor |
69/71 (1 ❌) | — |
Gestures |
55/56 ✓ | — |
InputTransparent |
42/42 ✓ | — |
ViewBaseTests |
112/112 ✓ | — |
🔍 AI analysis of failures — PR-related vs unrelated
🔍 AI-generated triage (GitHub Copilot CLI) — a heuristic judgement of whether each deep UI test failure is connected to this PR's changes. Verify before relying on it.
Likely unrelated: the failures appear pre-existing, flaky, or infrastructure.
- ● Unrelated — Existing Editor alignment UI test element lookup (~1 test):
EditorRuntimeTextAlignmentChangedfails with a generic AppiumNoSuchElementException, while the PR's iOS changes cacheUIView.Interactionsfor gesture/input-transparency performance and add a separate Editor stress test, with no plausible connection to runtime text-alignment element availability.
Strongest signal: the failure is an element-discovery error in an existing alignment scenario, not the new large-Editor freeze scenario or the modified iOS interaction-removal path.
❌ Editor — 1 failed test
EditorRuntimeTextAlignmentChanged
OpenQA.Selenium.NoSuchElementException : An element could not be located on the page using the given search parameters.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.Appium.AppiumDriver.FindElement(String by, String value)
at OpenQA.Selenium.Appium.MobileBy.FindElement(ISearchContext context)
at OpenQA.Selenium.WebDriver.FindElement(By by)
at OpenQA.Selenium.Appium.AppiumDriver.FindElement(By by)
at Microsoft.Maui.TestCases.Tests.KeyboardScrolling.CloseiOSEditorKeyboard(AppiumDr
...
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)
📋 Pre-Flight — Context & Validation
Issue: #34396 - UI becomes unresponsive when adding more than 200 Entry children to AbsoluteLayout
PR: #36671 - [iOS/Mac] Fix UI becoming unresponsive when adding many Entry/Editor children to AbsoluteLayout
Platforms Affected: iOS, MacCatalyst
Files Changed: 2 implementation, 2 test
Key Findings
- PR changes two iOS/MacCatalyst
UIView.Interactionsenumeration sites to cache the native interactions array before iterating, reducing repeated managed/native marshaling in gesture and tooltip setup paths. - The added UI test targets
Editoron iOS and waits for a bulk-add page to report completion, but the completed gate result shows the test passes both without and with the fix. - Prior inline review already flagged the same regression-test gap; that ❌ finding remains unresolved.
- Changed implementation files affect platform gesture/tooltip initialization paths used by controls such as
Editor/Entry, so adjacent gesture and input scenarios are in blast radius. ghis unauthenticated in this environment; PR and issue context was gathered through local git plus the public GitHub REST API.
Code Review Summary
Verdict: NEEDS_CHANGES
Confidence: low
Errors: 1 | Warnings: 0 | Suggestions: 0
Key code review findings:
- ✗
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34396.cs:28uses a threshold that prior gate evidence proved still passes without the production fix, so the test does not reproduce UI becomes unresponsive when adding more than 200 Entry children to AbsoluteLayout #34396.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #36671 | Cache UIView.Interactions in locals before iterating in gesture manager and tooltip lookup paths. |
❌ Gate failed: test passes without fix and with fix | src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs, src/Core/src/Platform/iOS/ViewExtensions.cs |
Original PR; production change appears localized, but regression test is not discriminating. |
🔬 Code Review — Deep Analysis
Code Review — PR #36671
Independent Assessment
What this changes: Caches UIView.Interactions locally before iterating in two iOS/MacCatalyst hot paths, plus adds an Appium regression test/page for adding 200 Editors.
Inferred motivation: Avoid repeated native-array marshaling that freezes UI when many Editor/UITextView instances are added.
Reconciliation with PR Narrative
Author claims: Redundant UIView.Interactions reads cause thousands of interop marshals; caching preserves behavior and improves responsiveness.
Agreement/disagreement: Production-code assessment matches. The regression-test claim is not verified: prior gate evidence says the test passes without the fix.
Prior Review Reconciliation
| Prior ❌ Error Finding | Source | Status | Evidence |
|---|---|---|---|
| Regression test does not reproduce #34396; it passed without the fix | MauiBot review + inline comment | ❌ Unresolved | Current head is the same reviewed commit 6203edb...; Issue34396.cs:28 still asserts only elapsed time < 10000, matching the prior failed gate evidence. |
External Output Contract
| Consumer token/pattern | Producer location | Producer emission condition | Consumer assumption | Ordinary negative case | Downstream effect |
|---|---|---|---|---|---|
| N/A | N/A | No changed code classifies external tool output with regex/string literals. | N/A | N/A | N/A |
Blast Radius Assessment
- Runs for all instances: Yes, for iOS/MacCatalyst views whose gesture/tooltip paths inspect
UIView.Interactions. - Startup impact: Possible during handler/page initialization for controls with these platform paths.
- Static/shared state: No new static/shared state.
CI Status
- Required-check result: fail/undetermined requiredness;
gh pr checks --requiredunavailable due unauthenticatedgh. - Classification: Public check-runs show
maui-pr-uitestsand Build Analysis failing; failure is Android DatePicker app crash, apparently unrelated to changed iOS/Mac Editor code. Separately, prior gate failure remains PR-relevant. - Action taken: Invoked
azdo-build-investigator;ci-analysisskill unavailable; capped confidence low.
Findings
❌ Error — Regression test does not prove the fix
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34396.cs:28 uses a broad elapsed-time threshold (< 10000) that prior gate runs proved still passes without the production fix. Since the test file is unchanged after MauiBot's ❌ finding, this PR still lacks a regression test that fails on base and passes with the fix.
Failure-Mode Probing
- Cached
Interactionsstale while removing: Load/tooltip updates are UI-thread platform work; no concurrent mutation path found, and snapshot iteration preserves intended removal/lookup behavior. - Null/default
Interactions: Existing code already dereferenced arrays in these OS-gated paths; caching does not add a new null-sensitive path. - Handler reconnect/disconnect: No new subscriptions or persistent state; disposal/removal logic remains unchanged.
- Test negative case: Base commit should fail the regression test; prior gate shows it passes, so coverage is insufficient.
Verdict: NEEDS_CHANGES
Confidence: low
Summary: The production optimization looks sound and appropriately localized, but an unresolved prior ❌ finding shows the added regression test does not catch the bug. CI required status could not be verified through authenticated gh, and public checks are red, so this cannot be LGTM.
🛠️ Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | Add a conservative empty-recognizer fast path in GesturePlatformManager.LoadRecognizers() and remove the PR's local Interactions caching. |
2 files | Issue34396 passed in 23s, but gate proved the same test passes without a fix. Broader/riskier than PR because it adds an early return in shared gesture setup. |
|
| 2 | try-fix | Cache owned/found UIToolTipInteraction instances with weak per-view storage and skip native scanning on no-tooltip updates. |
2 files | Issue34396 passed in 25s, but gate proved the same test passes without a fix. Adds tooltip discovery semantics and weak cache risk. |
|
| 3 | expert-review | Track MAUI-owned fake-right-click interactions instead of scanning native Interactions. |
❌ NOT RUN | 0 files | Rejected before application: not on the no-gesture iOS Editor repro path and would only validate via the same inadequate test. |
| PR | PR #36671 | Cache UIView.Interactions once at two local enumeration sites: fake-right-click cleanup and tooltip lookup. |
❌ Gate failed | 2 implementation files + 2 test files | Production change is the most localized runtime fix found, but the regression test is inadequate because it passes without the fix. |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| maui-expert-reviewer | 1 | Yes | Empty recognizer fast path in GesturePlatformManager.LoadRecognizers(). |
| maui-expert-reviewer | 2 | Yes | Owned UIToolTipInteraction cache to avoid no-tooltip native interaction scans. |
| maui-expert-reviewer | 3 | No applicable production fix | Proposed fake-right-click ownership registry, but it does not execute in the reported no-gesture iOS Editor repro. Recommended strengthening the regression test instead. |
Exhausted: Yes
Selected Fix: PR #36671's production fix remains preferable among runtime candidates because it is the narrowest and least behavior-changing approach. However, no fix is ready to accept until the regression test is strengthened: the gate showed Issue34396 passes both without and with the fix, so none of the passing candidate test results are probative.
Test Evidence
- Gate result already completed separately: ❌ FAILED because
Issue34396passed without the fix and with the fix. - try-fix-1 command:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "FullyQualifiedName~Issue34396"; result: test run successful, 1 passed,AddingManyEditorsDoesNotFreezeUIpassed in 23s. - try-fix-2 command:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "FullyQualifiedName~Issue34396"; result: test run successful, 1 passed,AddingManyEditorsDoesNotFreezeUIpassed in 25s.
Failure Analysis
The iterative loop did not find a demonstrably better runtime fix. Both materialized alternatives pass only the current inadequate test, and the third expert-generated idea is not applicable to the no-gesture repro. The critical blocker is test quality, not lack of runtime possibilities: before comparing PR #36671 against alternatives, Issue34396 needs to be made discriminating enough to fail on the broken baseline.
🏁 Report — Final Recommendation
Comparative Report — PR #36671
Candidates compared
| Rank | Candidate | Regression-test evidence | Assessment |
|---|---|---|---|
| 1 | pr-plus-reviewer |
Best overall direction: preserves the PR's localized, behavior-preserving production fix and incorporates the expert reviewer's required test-strengthening feedback. Still not merge-ready until the strengthened test is proven to fail without the fix and pass with it. | |
| 2 | pr |
❌ Gate failed: current test passed without the fix and with the fix | Best production-code candidate as submitted, but blocked by non-discriminating regression coverage. |
| 3 | try-fix-1 |
Issue34396 test |
Adds an empty-recognizer fast path and removes the PR's local interaction caching. Broader and riskier than the PR because it introduces an early return in shared gesture setup, and its pass result is not probative. |
| 4 | try-fix-2 |
Issue34396 test |
Adds weak tooltip interaction caching and changes no-tooltip native scanning behavior. Broader than the PR and has a concrete semantic risk for externally-added tooltip interactions. |
| 5 | try-fix-3 |
❌ Not run / not materialized | Rejected before application because tracking fake-right-click interactions does not address the no-gesture iOS Editor repro path. |
Regression-test rule application
No candidate has passed a discriminating regression test. The try-fix-1 and try-fix-2 runs are recorded as passing, but only against the same test that the gate proved also passes without any production fix; those are not treated as true regression passes. The raw PR's gate failure is a real blocker and keeps it below pr-plus-reviewer, whose only advantage is that it incorporates the expert reviewer's required correction to the test design.
Production-code comparison
The submitted PR fix is the narrowest runtime change. It caches UIView.Interactions at two local enumeration sites:
GesturePlatformManager.iOS.cs: fake-right-click cleanup now snapshotsPlatformView.Interactionsonce before reverse iteration.ViewExtensions.cs: tooltip lookup now snapshotsplatformView.Interactionsonce before enumerating.
This preserves existing behavior while eliminating redundant native array marshaling. By contrast, try-fix-1 changes gesture-manager control flow and try-fix-2 changes tooltip discovery/cache semantics; neither demonstrated a real fix because both relied on the non-discriminating test.
Winner
Winner: pr-plus-reviewer
This is the best candidate because it keeps the safest production fix and incorporates the only actionable expert feedback: strengthen the regression test. It is a conditional winner, not a merge-ready result, because the required gate was not re-run and the current gate evidence remains failed.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
…children to AbsoluteLayout (#36671) <!-- 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! ### Root Cause On iOS/MacCatalyst, `UIView.Interactions` is a native property — each read marshals the entire interactions array across the managed↔native interop boundary. A `UITextView` (the platform view behind `Editor`) carries ~22 interactions. Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once: * The gesture manager's recognizer-loading loop re-read it on every iteration (~2× per interaction). * The tooltip lookup read it twice (a null-check followed by an enumeration). Each `Editor` triggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds. ### Description of Change Cache the `Interactions` array into a local variable and read it once in both paths, then iterate the cached copy. The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical. ### Issues Fixed Fixes #34396 Tested the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Screenshots | Before Issue Fix | After Issue Fix | |------------------|-----------------| | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/46035bcb-8c52-4dc2-bb7f-5bb9f879a5cc" /><br><sub>iOS</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/48de15ae-8d2e-45d9-ad8a-93299285355a" /><br><sub>iOS</sub> | | <video width="350" alt="withoutfix" src="https://github.com/user-attachments/assets/f2f11304-9bfc-4db4-9524-b1955fcb3482" /><br><sub>MacCatalyst</sub> | <video width="350" alt="withfix" src="https://github.com/user-attachments/assets/9de4605b-ee01-4b38-b444-0ad86b720ac6" /><br><sub>MacCatalyst</sub> |
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!
Root Cause
On iOS/MacCatalyst,
UIView.Interactionsis a native property — each read marshals the entire interactions array across the managed↔native interop boundary. AUITextView(the platform view behindEditor) carries ~22 interactions.Two code paths in the gesture/handler setup re-read this property repeatedly per view instead of once:
Each
Editortriggers this setup during layout. At ~200 editors, the redundant reads compounded into thousands of full-array interop marshals on the UI thread, freezing the app for ~20 seconds.Description of Change
Cache the
Interactionsarray into a local variable and read it once in both paths, then iterate the cached copy.The change is purely an elimination of redundant interop calls — iteration order, removal logic, and tooltip resolution are unchanged, so behavior is identical.
Issues Fixed
Fixes #34396
Tested the behaviour in the following platforms
Screenshots
BeforeFix_iOS.mov
AfterFix_iOS.mov
BeforeFix_mac.mov
AfterFix_mac.mov