Skip to content

[iOS] Fix Shell navigation operations under the native More tab - #38805

Merged
kubaflo merged 6 commits into
dotnet:net11.0from
Vignesh-SF3580:fix-38323
Sep 28, 2026
Merged

kubaflo merged 6 commits into
dotnet:net11.0from
Vignesh-SF3580:fix-38323

Conversation

@Vignesh-SF3580

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!

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

  • Added active navigation controller selection to the iOS Shell renderer and handler.
  • Represented a More section's active stack from its section root through its pushed pages.
  • Routed insert, remove, pop, pop-to-root, native top-page comparison, and back-navigation state through the active controller.
  • Translated section-relative insertion indexes into indexes in the complete native More stack.
  • Routed removal of the visible top page through the existing pop path and returned immediately to avoid duplicate removal and disposal.
  • Updated the renderer to use the active More navigation controller consistently for More-tab sections.
  • Preserved the existing private-controller and pending-stack behavior for sections outside the More tab.

Issues Fixed

Fixes #38323

Screenshots

Before Issue Fix After Issue Fix
38323BeforeFix.mov
38323AfterFix.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 -- 38805

Or

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

@Vignesh-SF3580 Vignesh-SF3580 added the community ✨ Community Contribution label Sep 23, 2026
@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Sep 23, 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.

@Vignesh-SF3580 Vignesh-SF3580 changed the title [iOS] Fix Shell navigation operations under the native More tab [WIP] [iOS] Fix Shell navigation operations under the native More tab Sep 23, 2026
@github-actions github-actions Bot added area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/ios platform/macos macOS / Mac Catalyst labels Sep 23, 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 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Note

🔍 /review started

AzDO build 15430005 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.

@kubaflo

kubaflo commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@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 — 1 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-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) 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 23, 2026
@kubaflo

This comment has been minimized.

@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 — 1 findings

See inline comments for details.

MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates and removed s/agent-fix-win AI found a better alternative fix than the PR s/agent-review-in-progress AI review is currently running for this PR labels Sep 25, 2026
@kubaflo

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Tests Failure Analysis

@Vignesh-SF3580 — test-failure analysis for commit 31b9d7e.

Scope CI failures Commit 31b9d7e


🧪 CI Analysis — click to expand
📊 maui-pr

No failures found.


🧪 maui-pr-devicetests

🧪 maui-pr-uitests

🧭 Follow-up — actions and refresh

Next action: Rerun the affected Windows device-test and UI-test legs, prioritizing the canceled MacCatalyst Shell leg.

Maintainers: comment /review tests to refresh this report.

@Vignesh-SF3580

Copy link
Copy Markdown
Contributor Author

AI Review Summary

@Vignesh-SF3580 — new AI review results are available based on commit 31b9d7e.

Gate Passed Confidence Medium Platform iOS

🗂️ Review Sessions — click to expand

🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: IOS · Base: net11.0 · Merge base: 7fb54be9

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue38323 Issue38323 ✅ FAIL — 282s ✅ PASS — 111s
🔴 Without fix — 🖥️ Issue38323: FAIL ✅ · 282s
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 ✅ · 111s
(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-rc.2.26470.103)
[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/25/2026 5:47:26 AM FixtureSetup for Issue38323(iOS)
>>>>> 9/25/2026 5:47:30 AM NavigationOperationsWorkUnderMoreTab Start
>>>>> 9/25/2026 5:47:36 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: 26.6712 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.cs
  • src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs

📋 Pre-Flight — Context & Validation

PR #38805 Pre-Flight

Context

Problem

For Shell sections displayed through UIKit's native More tab, InsertPageBefore can throw IndexOutOfRangeException, and removing the visible top page can leave blank content. The section's private UINavigationController and UITabBarController.MoreNavigationController represent different stacks; operations derived from the visible More stack must not be applied to the private stack.

Existing PR Approach

The PR introduces an active-navigation-controller abstraction in both the compatibility renderer and handler. It routes insert, remove, pop, pop-to-root, top-page comparisons, and back-navigation restoration through MoreNavigationController for More-tab sections. In the handler it slices the native stack from the section root and offsets section-relative insertion indexes into the complete More stack. Removing the visible top page is redirected through the pop path with an immediate return.

Changed Files

  • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs — production fix
  • src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs — production fix
  • src/Controls/tests/TestCases.HostApp/Issues/Issue38323.cs — new UI-test host scenario
  • src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue38323.cs — new UI test

Only the two production files are safe try-fix targets. The new test files remain in place so the broken baseline can be exercised.

Validation Boundary

  • Primary and only supplied test: pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "Issue38323"
  • Mandatory regression tests supplied: none
  • Do not run the Shell category or any full test suite.
  • Each candidate gets one test pass and at most one focused correction/retest.

Worktree Safety

Pre-existing unrelated worktree changes exist under .github/scripts, .github/skills/verify-tests-fail-without-fix/scripts, and eng/scripts. They are out of scope and must remain untouched. Baseline establishment/restoration must use only .github/scripts/EstablishBrokenBaseline.ps1, as required by the try-fix skill.

🔬 Code Review — Deep Analysis

Expert PR Evaluation

Verdict: NEEDS_CHANGES

Confidence: medium

Independent Assessment

The submitted fix correctly routes most iOS Shell operations for a section displayed through UIKit's native More tab to the active MoreNavigationController. The compatibility renderer and Shell handler now use the visible native stack for insert, remove, pop, pop-to-root, top-page comparison, and back-navigation restoration, and the top-page removal paths return after delegating to pop so they do not remove or dispose the same controller twice.

The new UI test is a meaningful regression test for the reported active-section path: it opens an overflow tab, pushes a page, inserts before that page, removes the visible page, and pops to root. The trusted Gate confirms that this test fails without the submitted fix and passes with it.

Actionable Finding

❌ Error — Compatibility insertion does not handle an inactive More section

src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs:837 mutates the shared MoreNavigationController.ViewControllers array with the index supplied by NavigationViewControllers().IndexOf(beforeRenderer.ViewController). When a programmatic InsertPageBefore targets an overflow section that is not the More detail section currently represented in that shared stack, the before-page controller is absent and the index is -1. Unlike ShellSectionHandler.iOS.cs, the compatibility path has no section-root presence check or fallback to its private navigation stack before mutating the shared More stack.

The compatibility path should determine whether its section is actually represented in the shared More stack and fall back to the section-private stack when it is not. This should be applied as one consolidated pr-plus-reviewer refinement and validated with the supplied targeted Issue38323 command.

Blast Radius and Failure-Mode Probing

  • Scope: iOS compatibility Shell navigation for overflow sections; no startup or static/shared-state change.
  • Active More section: the submitted test covers this path and the Gate passed.
  • Inactive overflow section: programmatic insertion can resolve no native anchor in the currently visible More stack, yet the compatibility renderer still selects that shared controller.
  • Handler parity: the handler already checks whether its section root exists in the shared More stack and falls back to _navManager; the compatibility renderer does not.
  • Non-More sections: retain the existing private-controller and pending-stack behavior.
  • External output contract: not applicable.

CI Status

The trusted Gate passed. Required-check status could not be established through the unauthenticated local gh client, so broader CI remains undetermined and confidence is capped at medium for platform-specific navigation plumbing.

🛠️ Try-Fix — Analysis & Comparison

Try-Fix Candidate 1 (PR #38805)

Approach Description

Attempted a bounded alternative that avoids introducing shared ActiveNavigationController abstractions: add operation-boundary stack reconciliation checks for More-tab sections so insert/remove logic would detect divergence between section-private and visible More stacks and transform/reject unsafe operations locally.

Prior Approach Avoided

I did not repeat the existing PR strategy that routes insert/remove/pop/top-page/back comparisons through MoreNavigationController plus section-index offsetting via new active-navigation abstractions in both renderer and handler.

Mechanism-Level Difference

Prior approach centralizes all navigation operations through a new active-controller abstraction layer. This candidate planned to keep existing call paths and instead reconcile stack shape at each sensitive operation boundary; only divergent-stack cases would be transformed. That is a different root-cause mechanism (boundary validation vs global controller redirection).

Files Changed

No production code changes were applied.

Permitted targets (read-only in this blocked run):

  • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
  • src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs

Exact Diff

(no changes)

Test Results

Test command was not run:

  • pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "Issue38323"

Blocking condition occurred first during mandatory baseline establishment.

Failure Analysis

pwsh .github/scripts/EstablishBrokenBaseline.ps1 failed with dirty-working-directory guard due pre-existing unrelated changes in:

  • .github/scripts/*
  • .github/skills/verify-tests-fail-without-fix/scripts/*
  • eng/scripts/*

Because .github/.baseline-state.json was never created, proceeding with edits would violate try-fix baseline boundary and script-only restore safety.

Result

Blocked

Self-Review Count

0 findings (reviewer-findings.json = []).

Restore Status

Executed exact required restore command:

  • pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore
  • Output: No baseline state found / Restored False (expected because baseline state was never created).

Try-Fix Candidate 2 (PR #38805)

Approach Description

Planned a native-containment-directed alternative. Each navigation request would resolve its destination UINavigationController from the affected tracked UIViewController: the before-page controller for insert, the removed/top controller for remove or pop, and the tracked root for pop-to-root. Insertions would use the before controller as an identity anchor in its actual owner's native array; removals and pops would execute through that same owner.

Prior Approaches Avoided

This did not repeat the existing PR's section-wide ActiveNavigationController/NavigationViewControllers abstractions, global routing through MoreNavigationController, section-slice calculation, or numeric prefix offset. It also did not repeat candidate 1's planned localized stack-divergence guards and operation-boundary reconciliation at insert/remove boundaries.

Mechanism-Level Difference

The distinct root-cause hypothesis is incorrect ownership inference rather than merely divergent native stack shapes. UIKit's native containment relationship identifies which navigation controller currently owns an affected page controller. Following that relationship would make the before-page identity yield both the correct native stack and exact insertion anchor, while the removed/top-page identity would yield the controller that must remove or pop it. Thus the operation would not consult section-global More state, calculate a More-stack prefix offset, compare the private and More arrays, or reject a divergent boundary.

Files Changed

No production code changes were applied.

Permitted targets remained untouched:

  • src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
  • src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs

Exact Diff

(no changes)

Test Results

The supplied test was not run:

  • pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "Issue38323"

The mandatory baseline safety check blocked the attempt before implementation or testing.

Failure Analysis

pwsh .github/scripts/EstablishBrokenBaseline.ps1 rejected the pre-existing unrelated dirty files under:

  • .github/scripts/*
  • .github/skills/verify-tests-fail-without-fix/scripts/*
  • eng/scripts/*

The baseline log contains no Baseline established marker, and .github/.baseline-state.json was not created. Without a script-managed RevertedFiles allow-list, editing either target would violate the baseline boundary and make exact script-only restoration unverifiable. The unrelated dirty files were left untouched.

Result

Blocked

Self-Review Count

0 findings (reviewer-findings.json = []). The maui-expert-reviewer self-review was performed inline against the overarching principles and the always-active Logic and Correctness, Regression Prevention, and Complexity Reduction dimensions; there was no candidate code diff.

Attempt Artifacts

All mandatory artifacts were verified under:

  • CustomAgentLogsTmp/PRState/38805/PRAgent/try-fix/attempt-2/

Files: baseline.log, approach.md, reviewer-findings.json, reviewer-findings.diff, result.txt, fix.diff, test-output.log, and analysis.md.

Restore Status

Executed the exact required command after artifact capture:

  • pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore
  • Output: No baseline state found / Restored False, which is the expected no-state result because baseline establishment failed before any attempt edits.

📝 PR Finalize — Recommended Title & Description

Assessment: ✏️ Recommend updating — the description is detailed and accurate, but the [WIP] prefix makes the title unsuitable as the final searchable commit headline and the submitted UI-test coverage is not documented.

Recommended title

[iOS] Shell: Fix navigation operations under the native More tab

Recommended description

### 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
- Added active navigation controller selection to the iOS Shell renderer and handler.
- Represented a More section's active stack from its section root through its pushed pages.
- Routed insert, remove, pop, pop-to-root, native top-page comparison, and back-navigation state through the active controller.
- Translated section-relative insertion indexes into indexes in the complete native More stack.
- Routed removal of the visible top page through the existing pop path and returned immediately to avoid duplicate removal and disposal.
- Updated the renderer to use the active More navigation controller consistently for More-tab sections.
- Preserved the existing private-controller and pending-stack behavior for sections outside the More tab.

### Test Coverage
Added the iOS Issue38323 UI scenario covering insertion before the visible page, removal of the visible top page, and pop-to-root while navigating under UIKit's native More tab.

### Issues Fixed
Fixes #38323

### Screenshots

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video width="300" height="600" src="https://github.com/user-attachments/assets/71b5ca3f-e6f6-4404-91cb-4afbbac9d4b3"> | <video width="300" height="600" src="https://github.com/user-attachments/assets/04e2d9c1-08b4-49e2-952b-e33dc4796581"> |

🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Winner: pr

The raw submitted PR is the strongest available candidate because it is the only implementation with positive regression evidence: the trusted Gate confirms that Issue38323 fails without the fix and passes with the raw PR. It nevertheless retains the expert review's blocking compatibility-renderer edge case, so it is the comparative winner but is not ready for approval.

Candidate Comparison

Rank Candidate Implementation Validation Assessment
1 pr Routes iOS Shell More-tab insert, remove, pop, pop-to-root, top-page comparison, and handler back-navigation state through the visible native controller; adds the Issue38323 UI test. PASS — trusted Gate: test fails without the fix and passes with it. Best candidate because it fixes and preserves the supplied regression scenario. Expert review still found an unhandled inactive-overflow-section insertion path in the compatibility renderer.
2 pr-plus-reviewer Uses the before-page controller as the compatibility insertion anchor and attempts to fall back to the private section stack when the active More stack does not contain the section. FAIL — build succeeded with 0 errors, but Issue38323 failed with Insert failed: IndexOutOfRangeException. Ranked below the passing raw PR as required. The attempted root-identity check used the section renderer rather than the root page controller represented in the More stack, so the active path incorrectly fell back to a private stack that did not contain the pushed page.
3 try-fix-1 Proposed operation-boundary reconciliation for divergent private and More stacks. BLOCKED — no production diff and no test run because baseline establishment rejected the unrelated dirty infrastructure files. No executable candidate or regression evidence.
4 try-fix-2 Proposed resolving the owning navigation controller from each affected native view controller. BLOCKED — no production diff and no test run for the same baseline-establishment blocker. Mechanically distinct idea, but no implementation or evidence to compare.

Expert Review Finding

The compatibility renderer computes an insertion index from the shared More stack and then mutates that stack without first proving that the target overflow section is the section currently represented there. A programmatic InsertPageBefore against an inactive overflow section can therefore resolve the before-page controller to index -1 and throw or target the wrong native stack. The handler has a section-root presence fallback; the compatibility renderer does not.

The raw PR's test exercises the active More section and passed the trusted Gate, but it does not discriminate the inactive-overflow-section case. This is a concrete Shell/TabBar navigation ownership risk, so the expert verdict remains NEEDS_CHANGES.

Required Follow-up

Retain the raw PR behavior that passes Issue38323, then add a compatibility-renderer fallback keyed to the actual section root represented in MoreNavigationController.ViewControllers (the root page renderer, not the ShellSectionRenderer controller itself). The inactive-section path also needs focused regression coverage. No further refinement or retest was attempted in this run, per the one-patch/one-validation contract.

Evidence Summary

  • Raw PR Gate: passed.
  • Expert inline findings: 1 major correctness finding, persisted in inline-findings.json.
  • pr-plus-reviewer patch integrity: passed.
  • pr-plus-reviewer build: passed, 0 errors.
  • pr-plus-reviewer Issue38323 test: failed, 1 of 1.
  • Broader required-check state: undetermined in the unauthenticated environment.

📱 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

I have addressed the suggestion.

  • Added validation for the insertion index - Updated InsertViewController to check that the insertion index is greater than or equal to 0 before inserting into the active navigation controller. When the index is -1, the existing _pendingViewControllers path is used instead, avoiding an invalid insertion into the shared More navigation stack.

@Vignesh-SF3580 Vignesh-SF3580 changed the title [WIP] [iOS] Fix Shell navigation operations under the native More tab [iOS] Fix Shell navigation operations under the native More tab Sep 28, 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 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Note

🔍 /review started

AzDO build 15485772 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.

@kubaflo

kubaflo commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@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

@Vignesh-SF3580 — new AI review results are available based on commit 991a2c9.

Gate Passed Confidence Medium Platform iOS


🗂️ 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.cs
  • src/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.0 at merge base 2d84b49a
  • Materialized PR commit: 4ac4912962aeaf041e06608f5deb6761a49f82b5
  • Issue: #38323 reports that, inside iOS Shell's native More tab, InsertPageBefore throws IndexOutOfRangeException and 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.cs
  • src/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.cs
  • src/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: Issue38323 failed;
  • with the PR fix: Issue38323 passed;
  • 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.json under RevertedFiles; 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.ps1
    • eng/scripts/Set-ScreenResolution.ps1
    • eng/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.diff empty).
  • 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.diff is empty).
  • Test execution: the required Issue38323 command 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 match HEAD, 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.

@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 28, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review September 28, 2026 13:51
Copilot AI lite review requested due to automatic review settings September 28, 2026 13:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Critical navigation issues and test coverage gaps remain unresolved.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity

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.

Comment on lines +788 to +792
UINavigationController ActiveNavigationController()
{
if (IsInMoreTab && ParentViewController is UITabBarController tabBarController)
{
return tabBarController.MoreNavigationController;
Comment on lines +902 to +905
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.
@kubaflo
kubaflo merged commit 68fc8e6 into dotnet:net11.0 Sep 28, 2026
152 of 170 checks passed
@github-actions github-actions Bot added this to the .NET 11.0-rc2 milestone Sep 28, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios platform/macos macOS / Mac Catalyst 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-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) 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.

4 participants