Repository navigation
[iOS] Fix Shell navigation operations under the native More tab - #38805
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38805Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38805" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 1 findings
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
… Leaves Blank Page Under More Tab
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 1 findings
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📊 maui-prNo failures found. 🧪 maui-pr-devicetests
🧪 maui-pr-uitests
🧭 Follow-up — actions and refreshNext action: Rerun the affected Windows device-test and UI-test legs, prioritizing the canceled MacCatalyst Shell leg.
|
I have addressed the suggestion.
|
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@Vignesh-SF3580 — new AI review results are available based on commit
991a2c9.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: IOS · Base: net11.0 · Merge base: 2d84b49a
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🖥️ Issue38323 Issue38323 |
✅ FAIL — 243s | ✅ PASS — 99s |
🔴 Without fix — 🖥️ Issue38323: FAIL ✅ · 243s
Error-relevant lines (filtered from the build log):
at Microsoft.Maui.TestCases.Tests.Issues.Issue38323.NavigationOperationsWorkUnderMoreTab() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38323.cs:line 24
🟢 With fix — 🖥️ Issue38323: PASS ✅ · 99s
(no coded error found; showing last 1200 chars)
(.NETCoreApp,Version=v11.0)
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 11.0.0-rtm.26473.115)
[xUnit.net 00:00:00.05] Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.16] Discovered: Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net11.0/Controls.TestCases.iOS.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 9/28/2026 4:43:48 AM FixtureSetup for Issue38323(iOS)
>>>>> 9/28/2026 4:43:52 AM NavigationOperationsWorkUnderMoreTab Start
>>>>> 9/28/2026 4:43:59 AM NavigationOperationsWorkUnderMoreTab Stop
Passed NavigationOperationsWorkUnderMoreTab [6 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38323.trx
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 23.4688 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue38323.trx
📁 Fix files reverted (2 files)
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cssrc/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs
📋 Pre-Flight — Context & Validation
PR #38805 Pre-Flight
Context
- Title:
[iOS] Fix Shell navigation operations under the native More tab - Base:
net11.0at merge base2d84b49a - Materialized PR commit:
4ac4912962aeaf041e06608f5deb6761a49f82b5 - Issue: #38323 reports that, inside iOS Shell's native More tab,
InsertPageBeforethrowsIndexOutOfRangeExceptionand removing the visible top page leaves blank content. - Expected behavior: insertion succeeds, removing the current page reveals the inserted page, and pop-to-root returns to the section root.
Direct Diff Assessment
The PR changes both iOS Shell implementations:
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cssrc/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs
Its fix treats UITabBarController.MoreNavigationController as the active native controller for a section displayed under More. It routes insert, remove, pop, pop-to-root, top-controller comparisons, and back-navigation state through that controller. The handler also derives a section-relative active stack beginning at _rootViewController and translates section-relative insertion indexes into the complete More-stack index. Top-page removal is sent through the existing pop path and returns immediately to avoid a second removal.
The PR adds the focused UI reproduction in:
src/Controls/tests/TestCases.HostApp/Issues/Issue38323.cssrc/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38323.cs
The test opens the sixth Shell tab through native More, pushes a page, inserts before it, removes the visible page, and pops to root.
Validation Boundary
Primary and only supplied test:
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "Issue38323"No additional mandatory regression test was enumerated in the STEP 5a request. Do not run the full Shell category or any full test suite.
The completed gate must not be rerun. It proved:
- without the production fix:
Issue38323failed; - with the PR fix:
Issue38323passed; - gate-selected revertible production files: the two Shell files above.
Candidate Constraints
- Each candidate must use a root-cause mechanism different from the PR's broad active-controller substitution/index-translation approach and different from every earlier candidate.
- Modify only files listed in
.github/.baseline-state.jsonunderRevertedFiles; test files are read-only. - One implementation/test pass is allowed, followed by at most one focused correction/retest.
- Always restore with
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore. - Preserve these unrelated pre-existing worktree changes exactly:
.github/scripts/CopilotPipeline.Tests.ps1.github/scripts/Review-PR.Tests.ps1.github/scripts/RunTests.ps1.github/scripts/Set-ScreenResolution.Tests.ps1.github/scripts/shared/Detect-TestsInDiff.ps1.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1eng/scripts/Set-ScreenResolution.ps1eng/scripts/update-cgmanifest.ps1
Existing Evidence
- Gate: passed.
- Regression cross-reference: no overlap with labeled recent bug-fix PRs.
- Applicable guidance: iOS threading, handler lifecycle, UI-test conventions, and CI Copilot pipeline security rules.
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Verdict: LGTM
Confidence: Medium
Independent assessment
The submitted fix makes the native navigation controller that currently owns a Shell section authoritative for stack operations. For a section displayed through UIKit's native More tab, that controller is UITabBarController.MoreNavigationController; ordinary sections continue to use the section's private navigation controller and existing pending-stack manager.
The compatibility renderer now resolves insert/remove/dispose/top-page operations against the active controller. The handler additionally scopes its logical active stack from the section root within the shared More stack, translates section-relative insertion indexes into native-stack indexes, and uses the active navigation bar for back-button state restoration. Both implementations return immediately after routing removal of the visible page through the pop path, avoiding a second removal and disposal.
Soundness and blast radius
- The change is confined to iOS Shell navigation plumbing and the iOS-only More-tab UI-test scenario; no public API or shared state is added.
- Non-More sections retain the existing private-controller and pending-stack behavior.
- More-tab operations consistently use the controller that owns the visible stack, while the handler preserves section-relative stack semantics by slicing from
_rootViewController. - Reconnect and section-switch behavior do not introduce subscriptions or retained state; active-controller selection is computed at each operation.
- The regression test exercises the reported adjacent sequence: push, insert before the visible page, remove the visible page, then pop to root.
Findings
No actionable inline findings. inline-findings.json contains an empty JSON array.
Evidence
The trusted Gate reports that the regression test fails without the fix and passes with it. Gate verification was not rerun.
🛠️ Try-Fix — Analysis & Comparison
try-fix aggregate — PR #38805
Candidate 1 summary
- Status: Blocked
- Attempt dir:
CustomAgentLogsTmp/PRState/38805/PRAgent/try-fix/attempt-1/ - Planned approach: section-owned navigation-stack synchronization at root/visibility transitions under iOS More (no MoreNavigationController substitution/index translation).
- Why blocked: baseline setup command failed with DIRTY WORKING DIRECTORY before any edits; baseline state file was not created.
- Production edits: none (
fix.diffempty). - Test execution: required command not run due baseline block.
- Self-review: 0 findings (
reviewer-findings.json=[]). - Restore step: ran
EstablishBrokenBaseline.ps1 -Restore; reported no baseline state found.
Guidance for candidate 2 to avoid repetition
Do not retry the PR #38805 controller-substitution/global-index-translation design. Use a distinct root-cause mechanism and first resolve/handle baseline-establishment precondition in a way compliant with try-fix constraints.
Candidate 2 summary
- Status: Blocked
- Attempt dir:
CustomAgentLogsTmp/PRState/38805/PRAgent/try-fix/attempt-2/ - Planned approach: request-local decomposition of More-tab section requests into ordinary pop/push primitives at the section boundary, without broad active-controller substitution, global index translation, or persistent stack reconciliation.
- Why blocked: baseline setup again failed with DIRTY WORKING DIRECTORY on the same eight unrelated pre-existing tracked changes; baseline state was not created.
- Production edits: none (
fix.diffis empty). - Test execution: the required
Issue38323command was not run because the attempt was blocked before implementation/testing. - Self-review: 0 findings (
reviewer-findings.json=[]). - Restore step: ran
EstablishBrokenBaseline.ps1 -Restore; it reported no baseline state found. Both production files matchHEAD, and all eight pre-existing dirty paths remained unchanged.
Final bounded summary
Both permitted candidates are complete and were blocked before implementation by the mandatory baseline check. Candidate 1 planned section-owned stack synchronization/reconciliation; candidate 2 planned request-local operation decomposition. Neither changed production code or ran the focused test. Per the two-candidate bound, no more candidates will run.
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | iOS Shell More-tab stack ownership and the focused regression boundary were identified. |
| Code Review | LGTM (medium confidence) | 0 errors, 0 warnings, 0 actionable inline findings. |
| Gate | ✅ PASSED | iOS Issue38323 fails without the production fix and passes with it. |
| Try-Fix | ✅ COMPLETE | 2 attempts; both blocked before implementation or validation. |
| Report | ✅ COMPLETE | Selected Fix: PR |
Candidate Comparison
| Rank | Candidate | Implementation | Regression evidence | Assessment |
|---|---|---|---|---|
| 1 | pr |
Complete four-file fix covering the compatibility renderer, Shell handler, host-app reproduction, and iOS UI test. | ✅ Trusted Gate passed: fail without fix, pass with fix. | Winner. Correctly operates on the native controller that owns the visible More stack while preserving existing non-More behavior. |
| 2 | pr-plus-reviewer |
Identical to pr; the expert reviewer proposed no changes and reviewer.patch is empty. |
Same implementation and inherited Gate evidence as pr; no separate command was needed for a zero-delta candidate. |
Sound but offers no improvement. Prefer the submitted PR rather than request a no-op change. |
| 3 | try-fix-1 |
No implementation. Planned section-owned stack synchronization at visibility/root transitions. | ⚪ Blocked; required test was not run. | Cannot outrank a passing implemented fix. The mechanism remains hypothetical. |
| 4 | try-fix-2 |
No implementation. Planned request-local decomposition into ordinary pop/push operations. | ⚪ Blocked; required test was not run. | Cannot outrank a passing implemented fix. The mechanism remains hypothetical. |
No candidate failed a regression test. The only candidates without passing evidence were blocked before producing code, so they rank below the Gate-passing PR as required.
Code Review and Candidate Analysis
The expert pass found no actionable defects in the submitted diff. The active-controller selection is computed per operation, adds no shared or lifecycle state, and leaves the existing private navigation controller and pending-stack manager in place outside the native More tab. Within More, insert/remove/pop/pop-to-root/top-controller and back-navigation logic consistently use MoreNavigationController; the handler converts section-relative insertion positions into the shared native stack and scopes active pages from the section root.
The focused test covers the original failure and an adjacent sequence in one native More session: push, insert before the visible page, remove that visible page, reveal the inserted page, and pop to root. Returning immediately after top-page removal is delegated to the pop path avoids duplicate native removal and disposal.
Root Cause
UIKit presents Shell sections beyond the visible tab limit through a shared UITabBarController.MoreNavigationController. The affected code mixed that visible controller with each section's private navigation controller, so page references and indexes derived from one native stack were applied to another. This caused insertion to use an invalid index and top-page removal to leave the displayed More stack inconsistent.
Fix Quality
The submitted fix addresses stack ownership directly in both iOS Shell implementations, retains existing behavior for ordinary tabs, and includes a regression test proven by the trusted Gate. The regression cross-reference is clean, the expert review produced no blocking errors or discussion items, and neither alternative produced an implemented or validated improvement.
📱 UI Tests — Shell
Detected UI test categories: Shell
✅ Deep UI tests — 339 passed, 0 failed, 28 skipped across 1 category on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
Shell |
339/367 (28 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.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical navigation issues and test coverage gaps remain unresolved.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Fixes iOS Shell navigation under UIKit’s native More tab by aligning handler and compatibility renderer operations with the active navigation stack.
Changes:
- Routes navigation mutations through the active More navigation controller.
- Adds More-tab regression UI coverage.
- Corrects section-relative stack index handling.
Unresolved findings:
- Critical (3 votes): The compatibility renderer’s pop-to-root path still targets the private controller.
- Critical (1 vote): Several handler pop paths target the wrong controller and complete before native navigation finishes.
- Moderate (3 votes): The iOS-only test may run on Android.
- Nit (1 vote): Compatibility renderer coverage is missing.
| File | Summary |
|---|---|
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38323.cs |
Adds regression coverage; requires an Android exclusion and compatibility-host coverage. |
src/Controls/tests/TestCases.HostApp/Issues/Issue38323.cs |
Adds the More-tab reproduction page and navigation controls. |
src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs |
Updates active More-stack handling; unresolved incorrect-controller and completion-path issues remain. |
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs |
Updates active-stack handling; the pop-to-root path still bypasses the More controller. |
| UINavigationController ActiveNavigationController() | ||
| { | ||
| if (IsInMoreTab && ParentViewController is UITabBarController tabBarController) | ||
| { | ||
| return tabBarController.MoreNavigationController; |
| if (_rootViewController is not null && !ReferenceEquals(navigationController, _navigationController)) | ||
| { | ||
| navigationController.PopToViewController(_rootViewController, animated); | ||
| task = Task.FromResult(true); |
| @@ -0,0 +1,44 @@ | |||
| #if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST // The More tab appears differently on desktop platforms, so MoreNavigationController navigation cannot be tested on these platforms. | |||


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!
Issue Details
On iOS, Shell sections displayed through UIKit's native More tab used two navigation controllers inconsistently. InsertPageBefore could throw an IndexOutOfRangeException, and removing the visible top page could leave blank content. The issue is reproducible with both the compatibility Shell renderer and the Shell handler.
Root Cause
Push and ordinary pop operations used UITabBarController.MoreNavigationController, which owns the visible More stack. Insert, remove, pop-to-root, active-stack comparisons, top-page comparisons, and back-navigation restoration used the section's private navigation controller. As a result, target pages and indexes from the visible stack were applied to a different native stack.
Description of Change
Issues Fixed
Fixes #38323
Screenshots
38323BeforeFix.mov
38323AfterFix.mov