Repository navigation
[NET11] [iOS/MacCatalyst] Add an opt-in Shell handler implementation - #37034
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37034Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37034" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 — 5 findings
See inline comments for details.
I have addressed the valid suggestions.
|
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
I have addressed the valid suggestions.
|
There was a problem hiding this comment.
🔵 Needs a closer look
A confirmed logic error in ShellSectionHandler.OnRemoveRequested can double-dispose/remove when removing the top page, which risks incorrect navigation behavior at runtime.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
src/Controls/src/Core/Handlers/Shell/ShellHandler.iOS.cs:8
- ShellHandler.iOS.cs includes unused using directives (CoreAnimation, MediaPlayer). These generate CS8019 warnings and add noise to the file; remove them if they aren’t needed.
src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs:953
- OnRemoveRequested() calls OnPopRequested(e) when removing the top view controller, but then continues to call RemoveViewController(viewController) and DisposePage(page) unconditionally. This can double-dispose the page and attempt to remove the same controller twice while a pop is in flight.
OnPopRequested(e);
}
RemoveViewController(viewController);
DisposePage(page);
- Files reviewed: 19/19 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
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
db723ef.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ INCONCLUSIVE
Platform: IOS · Base: net11.0 · Merge base: d96aa524
🩺 Could not verify — environment/infrastructure error. The gate ran the tests but hit an environment error (an emulator/simulator/Appium/XHarness flake, a device that would not boot, or an empty/invalid result file), so it could not record a real pass/fail. The /review to retry on a fresh agent.
XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.WindowHandlerTests' (the target tests did not run).
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 WindowHandlerTests Category=Window |
🔴 Without fix — 📱 WindowHandlerTests: ⚠️ ENV ERROR · 78s
No log file found
🟢 With fix — 📱 WindowHandlerTests: ⚠️ ENV ERROR · 66s
No log file found
⚠️ Failure Details
⚠️ WindowHandlerTests without fix:XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.WindowHandlerTests' (the target tests did not run).⚠️ WindowHandlerTests with fix:XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.WindowHandlerTests' (the target tests did not run).
📁 Fix files reverted (14 files)
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellFlyoutContentRenderer.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellFlyoutLayoutManager.cssrc/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cssrc/Controls/src/Core/Handlers/Shell/ShellHandler.cssrc/Controls/src/Core/Hosting/AppHostBuilderExtensions.cssrc/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txtsrc/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txtsrc/Core/src/Handlers/FlyoutView/FlyoutViewHandler.iOS.cssrc/Core/src/Handlers/TabbedView/TabbedViewHandler.iOS.cssrc/Core/src/Platform/iOS/FlyoutContainerManager/FlyoutContainerManager.cssrc/Core/src/Platform/iOS/FlyoutContainerManager/IFlyoutContainerDelegate.cssrc/Core/src/Platform/iOS/NavigationControllerManager/NavigationControllerManager.cssrc/Core/src/Platform/iOS/TabBarControllerManager/ITabBarManagerDelegate.cssrc/Core/src/Platform/iOS/TabBarControllerManager/TabBarControllerManager.cs
New files (not reverted):
src/Controls/src/Core/Handlers/Shell/ShellContentHandler.iOS.cssrc/Controls/src/Core/Handlers/Shell/ShellHandler.iOS.cssrc/Controls/src/Core/Handlers/Shell/ShellItemHandler.iOS.cssrc/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs
📋 Pre-Flight — Context & Validation
PR #37034 Pre-Flight
Scope
- Title:
[NET11] [iOS/MacCatalyst] Migrate Shell to Handler architecture - Base / materialized head:
net11.0atd96aa524/ squashed review commitc9fd03d1aa - Platform: iOS
- Gate: Inconclusive.
WindowHandlerTestsdid not produce a fresh XHarness result with or without the PR, so this is an environment/build blocker rather than evidence that the implementation fails.
Problem and Existing Approach
The PR replaces the iOS/MacCatalyst compatibility ShellRenderer, ShellItemRenderer, and ShellSectionRenderer ownership model with four registered handlers:
ShellHandlerowns the root controller and sharedFlyoutContainerManager.ShellItemHandlerowns the tab controller throughTabBarControllerManager.ShellSectionHandlerowns the navigation controller throughNavigationControllerManager.ShellContentHandlerforwardsShellContent.Contentmapper updates to its owning section.
The implementation reuses compatibility appearance/page trackers through adapters, adds Shell-specific extension points to the shared flyout/tab/navigation managers, makes the handler path the unconditional default, and adds the corresponding iOS/MacCatalyst public API entries.
Direct Diff Inspection
The materialized PR changes 19 files: 4,089 insertions and 79 deletions.
- Four new production files contain the handler implementation:
src/Controls/src/Core/Handlers/Shell/ShellContentHandler.iOS.cssrc/Controls/src/Core/Handlers/Shell/ShellHandler.iOS.cssrc/Controls/src/Core/Handlers/Shell/ShellItemHandler.iOS.cssrc/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs
- Fourteen existing production files change handler registration, mapper/API surface, compatibility tracker behavior, and shared iOS manager extension points.
- The only test-file change adds
OnViewWillLayoutSubviews()to an existingITabBarManagerDelegatetest stub; it adds no behavioral assertion.
The current approach is a broad architecture migration rather than a narrow bug fix. An alternative must preserve handler registration, Shell navigation/tab/flyout behavior, and the public extensibility surface while using a meaningfully different mechanism from the PR or any prior attempt.
Test Commands
Primary detected test:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform ios -TestFilter "Category=Window"Mandatory regression test after the primary test passes:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Shell"The regression test comes from #36495, which fixed #36249 in ShellFlyoutLayoutManager.cs. The previously completed cross-reference run passed this Shell category, but every candidate must run it independently after its own primary test succeeds.
Try-Fix Restoration Constraint
The gate identified 14 baseline-revertible production files and four PR-added production files. The try-fix skill requires .github/.baseline-state.json to have an empty NewFiles array before editing; otherwise the attempt must be recorded as Blocked and restored without changing tracked files. Therefore each attempt must run the prescribed baseline script and honor its resulting state rather than manually deleting, restoring, or editing around this boundary.
Candidate Bounds
Each model gets one independent approach, one implementation/test pass, and at most one focused correction/retest. No gate rerun, full test suite, cross-pollination, external expert agent, or separate final audit is permitted.
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Reviewed candidate: pr (raw submitted PR fix, abf60611e18f368b1b3927b8d8325bdbf769ad36..db723ef2299cdd0942d10e4b6b9ce7a32653c991)
Expert verdict: LGTM
The expert reviewer found no actionable file:line correctness, lifecycle, platform, performance, API, or regression-prevention defects in the submitted iOS/MacCatalyst Shell handler migration. The required inline findings artifact contains an empty JSON array.
The Gate remains INCONCLUSIVE because the required tests could not be built or run. This is an evidence gap rather than a regression-test failure, so it does not invalidate the code-only expert verdict, but the PR remains unverified by that Gate.
🛠️ Try-Fix — Analysis & Comparison
Try-Fix Candidate 1 — PR #37034
Approach Description
Proposed (but not implemented due baseline contract): keep the handler migration, but defer initial Shell item/section containment and activation until the root host controller reports container readiness, instead of eager switching during ConnectHandler / mapper sequencing.
Prior Approach Avoided and Mechanism-Level Difference
The current PR’s mechanism is eager handler-time composition (ShellHandler/ShellItemHandler/ShellSectionHandler wire managers and switch current item during connection and property mapping).
This candidate intentionally avoids adding another eager connect-time path and instead targets lifecycle ordering instability.
Mechanism-level difference: first containment/selection would be gated on explicit host readiness so flyout/tab/navigation delegates execute only after a stable parent-child view-controller hierarchy exists.
Result
Blocked
Files Changed
None.
Full Candidate Diff
(empty diff)Exact Test Commands and Results
Primary command (run only if testing phase is reached):
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform ios -TestFilter "Category=Window"
Mandatory regression command (only after primary passes):
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Shell"
Tests were not run.
Reason:
- Mandatory baseline setup failed with dirty-worktree guard.
.github/.baseline-state.jsonwas absent.- Try-fix boundary rules require Blocked before editing when baseline state is absent/unsafe.
Failure / Blocker Analysis
pwsh .github/scripts/EstablishBrokenBaseline.ps1 failed because of pre-existing tracked modifications in the shared worktree.
Per try-fix baseline-file-boundary rules, proceeding without baseline state would make restoration unsafe, so the candidate was blocked before any tracked-file edits.
Mandatory restore command was executed:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore
Output: No baseline state found. Nothing to restore. Restored False (valid for this no-state blocked path).
Inline Self-Review
Findings count: 0
reviewer-findings.json:
[]Try-Fix Candidate 2 — PR #37034
Approach Description
Proposed (but not implemented because baseline safety blocked edits): preserve the new iOS/MacCatalyst handler registrations and let handlers own connection, mapper dispatch, and disposal, while making them thin composition adapters over the established compatibility Shell renderer graph. The compatibility flyout layout/content and page-tracker collaborators would be made handler-context-aware and reused as the single behavioral implementation. Shell-specific navigation, tab, flyout, appearance, and teardown behavior would therefore not be recopied into generalized FlyoutContainerManager, TabBarControllerManager, and NavigationControllerManager paths.
Comparison to the PR and Candidate 1
The PR performs a broad behavioral port: four handlers reconstruct legacy Shell behavior through shared platform managers and add Shell-specific manager extension points. This candidate instead hypothesizes that the primary regression risk is semantic drift introduced by duplicating thousands of lines of mature renderer behavior. It retains handler architecture at registration and lifecycle boundaries but composes the existing renderer algorithms internally, reducing the migration surface while preserving established behavior.
Candidate 1 proposed a different root cause and mechanism: eager initial containment/selection could run before the root host was ready, so it would defer activation until explicit host readiness. Candidate 2 does not defer initial activation or gate work on host readiness. It changes where behavior comes from: handler-owned adapters delegate to the proven compatibility compositor rather than reproducing behavior with new manager-backed implementations.
Mechanism-Level Difference
Handler ConnectHandler/mapper/disconnect operations would forward into adapterized compatibility components using the handler's MauiContext, virtual view, and parent controller. Because the legacy compositor remains the single path for selection ordering, native controller containment, flyout geometry, appearance updates, navigation completion, and disposal, parity follows from reuse rather than from re-deriving each edge case. This differs causally from the PR's new manager execution path and candidate 1's delayed execution timing.
Result
Blocked
The mandatory baseline command rejected pre-existing tracked harness modifications and did not create .github/.baseline-state.json. Under the try-fix boundary, an absent state file means there is no safe RevertedFiles allow-list, so no tracked production file could be edited. This is a baseline-safety blocker, not evidence that the PR, gate, or proposed candidate fails.
Files Changed
None.
Full Candidate Diff
(empty diff)Exact Test Commands and Results
Primary command, not run because the testing phase was not reached:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform ios -TestFilter "Category=Window"
Conditional mandatory regression command, not run because the primary command could not run:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Shell"
The gate was not rerun and its prior inconclusive XHarness result was not classified as a failure.
Failure / Blocker Analysis
Executed baseline command:
pwsh .github/scripts/EstablishBrokenBaseline.ps1
It failed with EstablishBrokenBaseline.ps1 failed: Working directory is not clean after listing the pre-existing tracked harness modifications. .github/.baseline-state.json was explicitly verified absent. No production edit or test was attempted.
Mandatory restore command was executed exactly:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore
Output: No baseline state found. Nothing to restore. and Restored False. This is the accepted no-state restoration result because baseline setup failed before state creation and this attempt made no tracked edits.
Attempt Artifacts
Stored in CustomAgentLogsTmp/PRState/37034/PRAgent/try-fix/attempt-2/: baseline.log, approach.md, result.txt, fix.diff, test-output.log, analysis.md, reviewer-findings.json, and reviewer-findings.diff.
Inline Expert Self-Review
The required overarching principles and always-active Logic and Correctness, Regression Prevention, and Complexity Reduction checks were applied inline. With no candidate code diff, there were 0 findings. reviewer-findings.json contains [].
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner
pr — the raw submitted fix
The submitted PR is the only fully implemented candidate, and the single expert review found no actionable errors, warnings, or discussion items. pr-plus-reviewer is intentionally source-equivalent because the reviewer had no correction to apply; choosing the raw PR avoids presenting an identical no-op derivative as an improvement.
Candidate Comparison
| Rank | Candidate | Implementation | Expert assessment | Validation evidence | Comparative result |
|---|---|---|---|---|---|
| 1 | pr |
Complete 19-file iOS/MacCatalyst Shell handler migration | LGTM, zero inline findings | Gate INCONCLUSIVE because XHarness produced no fresh Window results; separate Category=Shell regression cross-reference PASSED |
Winner. Only implemented candidate, no demonstrated defect, and no alternative provides a verified improvement. |
| 2 | pr-plus-reviewer |
Identical to pr; empty reviewer delta |
Inherits the same clean expert assessment | No candidate-specific rerun because no patch existed and Gate verification could not be rerun | Correct but provides no code or evidence advantage over the submitted PR. |
| 3 | try-fix-1 |
Not implemented; proposed deferring initial containment/selection until host readiness | No candidate code to assess | Blocked before edits; no primary or regression test ran | An untested lifecycle-ordering hypothesis cannot outrank working reviewed code. |
| 4 | try-fix-2 |
Not implemented; proposed thin handler adapters over the compatibility renderer graph | No candidate code to assess | Blocked before edits; no primary or regression test ran | A broader untested alternative with no diff cannot outrank working reviewed code. |
Decision Rationale
- No candidate failed a regression test. The two
try-fix-*candidates were blocked before implementation or testing, which is uncertainty rather than failure. - The Gate's missing XHarness results do not prove either success or failure and are not used as grounds to request changes.
- The raw PR's Shell regression cross-reference passed, and the expert reviewer found no concrete lifecycle, mapper, teardown, manager-extension, API, or platform defect.
pr-plus-reviewerhas an emptyreviewer.patch, so its runtime behavior and risk are exactly the same aspr; the original submitted candidate wins the tie.
Residual Uncertainty
The Window device-test Gate remains unverified because the target tests did not produce results. Approval is therefore based on the submitted implementation's code quality, the clean expert review, and the available passing Shell regression evidence—not on a successful Gate run.
🔗 Regression Cross-Reference
🔍 Regression Cross-Reference
⚠ Overlaps with prior bug-fix PRs — same files modified, but no exact line revert detected.
| File | Fix PR | Fixed issue(s) |
|---|---|---|
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellFlyoutLayoutManager.cs |
#36495 | #36249 |
🧪 Regression Tests to Verify
These tests were added by the overlapping fix PRs. Running them to verify no side-effect regressions:
| Fix PR | Type | Test | Filter |
|---|---|---|---|
| #36495 | DeviceTest | ShellTests | Category=Shell |
🧪 Regression Test Results
✅ PASSED — 1 passed, 0 failed, 0 skipped
| Fix PR | Test | Type | Result |
|---|---|---|---|
| #36495 | ShellTests | DeviceTest | ✅ PASSED |
📱 UI Tests — Shell,ViewBaseTests
Detected UI test categories: Shell,ViewBaseTests
✅ Deep UI tests — 428 passed, 0 failed, 16 skipped across 2 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
Shell |
316/332 (16 skipped) ✓ | — |
ViewBaseTests |
112/112 ✓ | — |
📎 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.
PR 37034 adversarial review and local iOS validation
Adversarial review: Needs human investigation - click to expandOverall verdict: Needs human investigation Merge answer: Do not merge in the current state. The exact-head Shell coverage is strong and did not reproduce a PR-specific regression, but CI has not earned green: 10 checks failed, 2 were canceled, the in-scope MacCatalyst Shell UI leg was canceled, two review threads remain unresolved, and GitHub reports Coverage: 123 checks - 111 passing/neutral/skipped - 12 failing - 0 pending - 0 inaccessible - 2 unmapped - 7 unexplained build legs - 0 unaccounted failing checks - 2 aborted failing checks - 0 canceled-build checks - 6 device-test checks unverified by the deterministic gatherer - 27 unattributed - 0 regressed-vs-base. Deterministic ceiling: Needs human investigation. Exact-head local results
The local runs used an iPhone 11 Pro iOS 26.5 simulator with Xcode 26.6 and .NET The seven local UI failures were:
I reran all seven against the then-current GPT-only adversarial reviewIndependent reviews used GPT-5.6 Sol, GPT-5.5, GPT-5.3 Codex, and GPT-5.6 Terra, followed by targeted code tracing and simulator probes. The review covered navigation-stack synchronization, custom back buttons, More-tab routing, collection mutation/reset paths, tab enabled state, search dismissal, transition races, and RTL locked-flyout layout. No PR-specific blocking defect was reproduced. In particular, a targeted test for the custom back-icon native-pop path passed and was removed after the probe. Two existing review threads still need an explicit resolution:
CI failure classification
The required Recommended actionComplete or rerun the canceled MacCatalyst Shell leg, classify the seven unexplained build legs and remaining unattributed failures, and resolve the two code-review threads. Merge only after CI earns a trustworthy green result and the blocking review state is cleared. Evidence details
|
kubaflo
left a comment
There was a problem hiding this comment.
It is a bit late to add it to net11 - Could we please create opt-in Shell2 with this implementation and keep the current shell for iOS as it is. I'd love to have this PR merged, though. Let me know if you need some help with this
Keep ShellRenderer as the default implementation on iOS and Mac Catalyst. Allow applications to opt in to the new ShellHandler hierarchy through the UseiOSShell2Handler MSBuild property.
|
/azp run maui-pr-uitests , maui-pr-devicetests |
There was a problem hiding this comment.
🔵 Needs a closer look
A confirmed double-dispose/double-remove bug exists in ShellSectionHandler.OnRemoveRequested when removing the top view controller.
Review details
Suppressed comments (1)
src/Controls/src/Core/Handlers/Shell/ShellSectionHandler.iOS.cs:950
- OnRemoveRequested invokes OnPopRequested when removing the top view controller, but then continues to call RemoveViewController/DisposePage. This can double-dispose the page (and try to remove the same VC twice) because OnPopRequested already performs the pop and calls DisposePage after the pop completes.
if (viewController == _navigationController.TopViewController)
{
e.Animated = false;
OnPopRequested(e);
}
- Files reviewed: 21/21 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
@kubaflo I have updated the changes to keep ShellRenderer as the default implementation on iOS and Mac Catalyst, and made the new ShellHandler implementation opt-in through UseiOSShell2Handler. |
Empirical iOS review (
|
| Before Locked | RTL + Locked |
|---|---|
![]() |
![]() |
- Navigation under the native More tab is inconsistent. Push and ordinary pop work, but
InsertPageBeforechanges the logical stack and then throwsArgumentOutOfRangeExceptionfromNavigationControllerManager.InsertViewController. Removing the current top page andPopToRootAsynccomplete logically while UIKit remains on a blank staleMore Twocontroller. These failures reproduced in runs 4-6. The implementation usesMoreNavigationControllerfor push/pop but the regular_navManagerfor insert/remove/pop-to-root inShellSectionHandler.iOS.cs.
| Insert exception after logical mutation | Blank stale native controller after pop-to-root |
|---|---|
![]() |
![]() |
- Section mutation followed by Shell replacement aborts the app. Adding/removing a
ShellContentand synchronously replacingWindow.Pageterminated the process withSIGABRTimmediately after the replacement marker in four retained runs. No.ipsreport was emitted, so I am not assigning a narrower root cause than the deterministic mutation/disconnect sequence.
CI context
The current rollup has 126 checks: 116 passing/neutral/skipped and 10 failing. Deterministic base comparison caps CI at Needs human investigation: the Mac Catalyst Shell UI-test leg was canceled, iOS Mono device tests contain unmatched Shell-adjacent failures, and several failed legs remain unattributed. More importantly, no checked-in test configuration enables UseiOSShell2Handler, so existing CI does not validate this new hierarchy.
I would hold the PR until the three reproduced failures are fixed and covered by tests that explicitly enable the opt-in handler.
There was a problem hiding this comment.
Awesome! There is still a few issues it seems, but now we will be able to include it in the rc2 once bugs are fixed :) Also a suggestion from @PureWeen - we can just call it ShellHandler since shell didn't have handler implementation
…t-in Prevent queued header updates from accessing ShellSectionHandler.VirtualView after the handler has disconnected during a synchronous Window.Page replacement. Rename UseiOSShell2Handler to UseiOSShellHandler across the MSBuild property, runtime feature switch, and handler registration.
|
@kubaflo I have addressed the valid suggestions. Please find the details below. RTL + FlyoutBehavior.Locked hides the detail pane: |
There was a problem hiding this comment.
🟡 Changes recommended
The PR description’s opt-in naming doesn’t match the implemented switch/property names, and the new opt-in path appears to lack CI test coverage exercising the iOS/MacCatalyst handler.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs:1250
SearchItemSelectedDelegatereplaces any existingUISearchController.Delegatebut does not forwardDidDismissSearchControllerto the previous delegate. If any other code relies on that callback, it will silently stop working for the dismissal that triggers navigation. Consider chaining the dismissal callback to the prior delegate after restoring it.
if (searchController.Delegate == this)
{
searchController.Delegate = _previousDelegate!;
}
- Files reviewed: 21/21 changed files
- Comments generated: 2
- Review effort level: Lite
Follow-up empirical iOS review (
|
| Fixed teardown sequence | Search delegate/navigation probe |
|---|---|
![]() |
![]() |
Reclassified parity defects
- RTL +
FlyoutBehavior.Locked: failed under the new handler and under legacyShellRenderer2/2 with the same1.0000 -> 0.0000 -> 1.0000detail-pixel result. This confirms [iOS] [ShellRenderer] RTL + FlyoutBehavior.Locked Hides the Detail Pane #38322 is pre-existing. - Native More navigation:
InsertPageBefore, remove-current-top, andPopToRootAsyncfail/desynchronize in both implementations 2/2. This confirms [iOS] [ShellRenderer] InsertPageBefore Throws Exception and Removing Top Page Leaves Blank Page Under More Tab #38323 is pre-existing; the unresolvedOnRemoveRequestedfinding is real behavior but not introduced by this PR.
| Opt-in handler | Legacy renderer |
|---|---|
![]() |
![]() |
CI and remaining risk
Exact-head maui-pr build 1587130 passed 30/31 jobs, including all macOS builds, pack jobs, integration tests, and every iOS run. Its only failure was SkiaSharpSvgToolsTests.Resize.BasicNoScaleReturnsOriginalSize on Windows Release: fixture cleanup hit a transient temp-file lock. The PR does not touch Resizetizer, and the exact pre-existing fixture defect and validated fix are documented in #37883.
The remaining risk is coverage rather than a demonstrated regression: no checked-in test enables this opt-in hierarchy or protects the new disconnect guard. The Feature Parity section should also acknowledge #38322 and #38323. Confidence is low until required CI reruns green, but the current evidence supports merging once that unrelated gate passes.








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!
Description of Change
Introduces a new handler-based implementation of
Shellfor iOS and Mac Catalyst while retaining the compatibilityShellRendereras the default implementation.The new implementation replaces the monolithic
ShellRenderer(IS aUIViewController),ShellItemRenderer(IS aUITabBarController), andShellSectionRenderer(IS aUINavigationController) hierarchy with a layeredShellHandler,ShellItemHandler,ShellSectionHandler, andShellContentHandlerarchitecture.Navigation, tab-bar, and flyout management are implemented on top of the shared Core platform managers:
NavigationControllerManagerTabBarControllerManagerFlyoutContainerManagerThis is the same infrastructure already used by the
NavigationPage(#36109),TabbedPage(#36507), andFlyoutPage(#36676) handler migrations.The new Shell handler is opt-in on iOS and Mac Catalyst. Applications continue to use
ShellRendererunless they explicitly enable the new implementation in their project file.Motivation
ShellRenderer,ShellItemRenderer, andShellSectionRendererare renderer classes that directly inherit fromUIViewController,UITabBarController, andUINavigationController. Each renderer owns flyout presentation, tab-bar management, navigation-stack management, appearance tracking, and page lifecycle behavior.This made Shell:
NavigationPage,TabbedPage, andFlyoutPagehave moved to handlers on iOS and Mac Catalyst, while Shell still uses renderers.What Changed
New Shell handlers
Handlers/Shell/ShellHandler.iOS.csShell. Owns the app root view controller and container view; drives flyout presentation throughFlyoutContainerManager; handles More-tab overflow and status-bar/home-indicator forwarding; and exposes virtual factory hooks for appearance trackers, page tracking, item and section handlers, and flyout content.Handlers/Shell/ShellItemHandler.iOS.csShellItem. Owns aUITabBarControllerthroughTabBarControllerManager; tracks the current section, tab selection, More-tab overflow, badges, enabled state, and tab-bar visibility.Handlers/Shell/ShellSectionHandler.iOS.csShellSection. Owns aUINavigationControllerthroughNavigationControllerManager; manages push/pop operations, per-page navigation-bar appearance and visibility, and swipe-back behavior.Handlers/Shell/ShellContentHandler.iOS.csShellContent. ItsContentmapper forwardsShellContent.Contentchanges to the owningShellSectionHandler.Modified files
Platform/iOS/NavigationControllerManager/NavigationControllerManager.csPlatform/iOS/TabBarControllerManager/TabBarControllerManager.cs,ITabBarManagerDelegate.csShellItemHandlercan manage tab selection and More-tab navigation through the shared manager.Platform/iOS/FlyoutContainerManager/FlyoutContainerManager.cs,IFlyoutContainerDelegate.csFlyoutPagebehavior.Handlers/FlyoutView/FlyoutViewHandler.iOS.cs,Handlers/TabbedView/TabbedViewHandler.iOS.csCompatibility/Handlers/Shell/iOS/ShellFlyoutContentRenderer.cs,ShellFlyoutLayoutManager.csCompatibility/Handlers/Shell/iOS/ShellPageRendererTracker.csHandlers/Shell/ShellHandler.csHosting/AppHostBuilderExtensions.csShellRendereras the iOS and Mac Catalyst default and registers the new Shell handler hierarchy when the runtime feature switch is enabled.Core/src/RuntimeFeature.csIsiOSShellHandlerEnabled, with a default value offalse.Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targetsUseiOSShellHandlerproject property to the runtime feature switch.PublicAPI/net-ios/PublicAPI.Unshipped.txt,PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txtArchitecture Overview
Handler hierarchy
Key Design Decisions
NavigationControllerManager,TabBarControllerManager, andFlyoutContainerManagerwere designed for reuse by page implementations. Using them keeps navigation, tab-bar, and flyout behavior consistent and avoids another Shell-specific implementation.FlyoutPage,TabbedPage, andNavigationPagebehavior is preserved.ShellItemHandlerAdapter : IShellItemRendererandShellSectionHandlerAdapter : IShellSectionRendererallow the new handlers to reuse the existing navigation-bar, tab-bar, page, toolbar, and flyout tracking infrastructure.ShellHandlerexposesCreate*virtual methods so custom handler implementations can replace appearance trackers and child handlers similarly to custom renderer subclasses.ShellHandler,ShellItemHandler,ShellSectionHandler, andShellContentHandleruse property and command mappers, matching the Android and Windows implementations.ShellContentHandleras a content-change bridgeShellContentHandlerreceivesShellContent.Contentchanges and forwards them to the owning section handler.ShellRendereras the default allows existing applications to retain current behavior while the new implementation is evaluated through an explicit opt-in.Key Interfaces Reused
IShellItemRendererShellItemHandlerAdapterShellItemHandlerto participate in existing compatibility infrastructure that expects an item renderer.IShellSectionRendererShellSectionHandlerAdapterShellSectionHandlerto participate in existing compatibility infrastructure that expects a section renderer.IShellNavBarAppearanceTrackerShellSectionHandlerIShellTabBarAppearanceTrackerShellItemHandlerIShellPageRendererTrackerShellSectionHandlerIShellFlyoutContentRendererShellHandlerHandler Registration and Opt-In
The compatibility
ShellRendererremains the default implementation on iOS and Mac Catalyst.To enable the new Shell handler, set
UseiOSShellHandlertotruein the application project:When the property is absent or set to
false, the application continues to useShellRenderer:The property is mapped to the following runtime host configuration option:
The runtime feature switch defaults to
false.No
UseiOSShellHandler()builder extension is introduced.As an alternative to the project property, an application can manually register the complete Shell handler hierarchy through
ConfigureMauiHandlersinMauiProgram.cs:All four mappings must be registered together because they form the complete iOS and Mac Catalyst Shell handler hierarchy. Applications using the
UseiOSShellHandlerproject property do not need this manual registration.Feature Parity
The handler implementation covers the existing Shell scenarios, including:
FlowDirectionpropagation.IQueryAttributable.Compatibility and Migration Guidance
Existing applications
Existing applications require no changes. If
UseiOSShellHandleris not set, they continue to use the compatibilityShellRenderer.Evaluating the new handler
Applications can evaluate the handler by setting:
Removing the property or setting it to
falserestores the compatibility renderer.Custom renderer users
Applications that subclass or manually register
ShellRenderer,ShellItemRenderer, orShellSectionRenderercan continue using those implementations. The compatibility renderer classes remain available and are still the default.Custom handler users
Applications that opt in and need custom behavior can subclass the new handler classes or manually register custom handlers through
ConfigureMauiHandlers.ShellRendereris aUIViewControllerShellHandlerowns and manages aUIViewControllerthroughFlyoutContainerManagerViewHandler<Shell, UIView>, not a view-controller subclass.ShellItemRendereris aUITabBarControllerShellItemHandlerowns and manages aUITabBarControllerthroughTabBarControllerManagerElementHandler<ShellItem, UIView>.ShellSectionRendereris aUINavigationControllerShellSectionHandlerowns and manages aUINavigationControllerthroughNavigationControllerManagerElementHandler<ShellSection, UIView>.ShellHandler.Create*virtual factory methodOnElementPropertyChanged