[iOS 26] Navigation hangs after rapidly open and closing new page using Navigation.PushAsync - fix#32456
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds defensive null checks to improve robustness in the iOS ShellSectionRenderer navigation handling.
- Adds null check for page elements at target index to prevent potential null reference exceptions
- Adds null-conditional operator when accessing renderer.ViewController to handle cases where Handler might be null
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
Show resolved
Hide resolved
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com>
…avigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
PR #32456 Review SummaryOverviewPR Title: [iOS 26] Navigation hangs after rapidly open and closing new page using Navigation.PushAsync - fix Problem StatementNavigation hangs and shows a blank white screen when rapidly opening and closing pages using Original PR ChangesThe PR made two key changes to Change 1: Line 127 - Add null check for pages[targetIndex]- if (targetIndex < 0 || targetIndex >= pages.Count)
+ if (targetIndex < 0 || targetIndex >= pages.Count || pages[targetIndex] is null)Change 2: Line 583 - Add null-conditional operator for renderer.ViewController- if (viewController == renderer.ViewController)
+ if (viewController == renderer?.ViewController)Review AnalysisCopilot Review Comment #1: Null Check on Line 127Copilot's Suggestion: Remove Analysis: ❌ INCORRECT Reasoning:
Recommendation: ✅ KEEP the null check as-is from the PR Copilot Review Comment #2: Inconsistent Cast on Line 582-583Copilot's Suggestion: Change hard cast to safe cast Analysis: ✅ CORRECT Original Code: var renderer = (IPlatformViewHandler)child.Handler; // Line 582 - hard cast
if (viewController == renderer?.ViewController) // Line 583 - null-conditionalProblem:
Fix Applied: var renderer = child.Handler as IPlatformViewHandler; // Safe cast
if (viewController == renderer?.ViewController) // Null-safe checkRecommendation: ✅ Apply the fix (changed from hard cast to Changes Made During Review
Final RecommendationAPPROVE with modifications: The PR correctly addresses the iOS 26 navigation hang issue with appropriate null checks. The review identified one valid improvement (line 582 cast consistency) which has been applied. The first review comment was incorrect and the original PR code should be kept. Summary of All Changes:diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
index 90c0c7fc0e..77cc4f3465 100644
--- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
+++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs
@@ -124,7 +124,7 @@ namespace Microsoft.Maui.Controls.Platform.Compatibility
// Bounds check: ensure we have a valid index for pages array
int targetIndex = NavigationBar.Items.Length - 1;
- if (targetIndex < 0 || targetIndex >= pages.Count)
+ if (targetIndex < 0 || targetIndex >= pages.Count || pages[targetIndex] is null)
return true;
_shellSection.SyncStackDownTo(pages[targetIndex]);
@@ -579,8 +579,8 @@ namespace Microsoft.Maui.Controls.Platform.Compatibility
{
if (child == null)
continue;
- var renderer = (IPlatformViewHandler)child.Handler;
- if (viewController == renderer.ViewController)
+ var renderer = child.Handler as IPlatformViewHandler;
+ if (viewController == renderer?.ViewController)
return child;
}Why These Changes Are Correct:
All three changes work together to handle null scenarios that can occur during rapid navigation operations on iOS 26. Testing RecommendationThe PR should be tested with:
|
|
What's the stack trace of the exception? |
) * [iOS 26] Fix null reference and cast safety in ShellSectionRenderer navigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> * Initial plan * Applied PR dotnet#32648 changes for review Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Add UI test case for issue dotnet#32616 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Final review summary for PR dotnet#32648 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
* [iOS 26] Fix null reference and cast safety in ShellSectionRenderer navigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> * Initial plan * Applied PR dotnet#32648 changes for review Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Add UI test case for issue dotnet#32616 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Final review summary for PR dotnet#32648 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com> Co-Authored-By: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
* [iOS 26] Fix null reference and cast safety in ShellSectionRenderer navigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> * Initial plan * Applied PR dotnet#32648 changes for review Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Add UI test case for issue dotnet#32616 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Final review summary for PR dotnet#32648 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com> Co-Authored-By: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
|
@PureWeen there's no exception. The page just doesn't render |
Can we change it to use pattern matching? |
If you enable first chance exceptions or do like a, try catch and break point the catch? |
|
/rebase |
f8023e6 to
566a56f
Compare
PureWeen
left a comment
There was a problem hiding this comment.
Did you try to see if copilot could create a UItest that reproduces this issue?
Or perhaps we could do a device test?
I'm thinking maybe there'd be a way to issue a bunch of push and pops really quickly maybe?
|
I can easily replicate it manually, but I didn't find a way to do it with UITest. Agents also tried many ti Test Validation Result: The Issue32425 test has been significantly improved to match the actual user scenario (rapid back button tapping), but it still does not consistently fail without the PR's fix on iOS 26.1. What Was Accomplished ✅ Test now matches the actual bug scenario: ✅ Test passes WITH the fix ✅ Code is cleaner and more maintainable ❌ Test does not fail WITHOUT the fix (on iOS 26.1 simulator) Why the Test Doesn't Catch the Bug The race condition in iOS 26 is extremely timing-sensitive and depends on factors that are difficult to control in automated testing: PR Fix Analysis The PR's fix is defensively correct even without a failing test: This is valid defensive programming: Recommendation ✅ APPROVE the PR with the improved test, despite it not failing without the fix. Rationale: Documentation: Note in PR review that the bug is timing-sensitive and difficult to reproduce consistently in automation, but the fix is valid defensive programming. Screen.Recording.2025-12-31.at.17.23.55.mov |
PR Review: #32456 - iOS 26 Navigation Hang FixDate: 2026-01-02 | Reviewer: pr-reviewer agent | PR: #32456 ✅ APPROVEIssue: Navigation hangs on iOS 26 during rapid push/pop operations
Key Finding: Copilot-reviewer was wrong about "redundant null check" - the navStack explicitly contains null entries. 📋 Pre-Flight DetailsPR Summary
Issue Summary
Fix Files
Key DiscussionsDisagreements:
Maintainer Requests: 🔍 Phase 1: Root Cause AnalysisThe List<Page> _navStack = new List<Page> { null }; // Line 251This happens in multiple places:
When rapid push/pop operations occur on iOS 26, the timing can cause:
📝 Phase 2: Fix AnalysisChange 1 (Line 127): Add null check-if (targetIndex < 0 || targetIndex >= pages.Count)
+if (targetIndex < 0 || targetIndex >= pages.Count || pages[targetIndex] is null)✅ Prevents Change 2 (Lines 578-581): Pattern matching refactor-if (child == null)
- continue;
-var renderer = (IPlatformViewHandler)child.Handler;
-if (viewController == renderer.ViewController)
+if (child?.Handler is IPlatformViewHandler { ViewController: var vc } && viewController == vc)✅ Cleaner, handles all null scenarios in one expression Comparison
🧪 Phase 3: Regression CheckEdge Cases Verified
Disagreement Resolution
|
…ng Navigation.PushAsync - fix (#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…s navigation The test was failing because PR dotnet#32456 removed the _popRequested flag and logic that was originally added in PR dotnet#24003 to fix issue dotnet#23892 (long-press back button navigation not updating Shell's current page). Later, PR dotnet#29825 expanded the DidPopItem method with null checks and manual synchronization, but removed the _popRequested flag handling. This commit restores the _popRequested logic while keeping the null checks: - For user-initiated navigation (_popRequested == false), call SendPop() which triggers GoToAsync and properly fires navigation events - For programmatic navigation (_popRequested == true), use manual synchronization with null checks to prevent crashes Also fixes ElementForViewController to properly handle null ViewControllers by avoiding property pattern matching that requires non-null values. Fixes dotnet#33379
…ng Navigation.PushAsync - fix (#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…s navigation The test was failing because PR dotnet#32456 removed the _popRequested flag and logic that was originally added in PR dotnet#24003 to fix issue dotnet#23892 (long-press back button navigation not updating Shell's current page). Later, PR dotnet#29825 expanded the DidPopItem method with null checks and manual synchronization, but removed the _popRequested flag handling. This commit restores the _popRequested logic while keeping the null checks: - For user-initiated navigation (_popRequested == false), call SendPop() which triggers GoToAsync and properly fires navigation events - For programmatic navigation (_popRequested == true), use manual synchronization with null checks to prevent crashes Also fixes ElementForViewController to properly handle null ViewControllers by avoiding property pattern matching that requires non-null values. Fixes dotnet#33379
…ts (#33380) ### Description of Change Fixes long-press back button navigation not triggering `OnAppearing` and other navigation events in Shell. **Problem:** Test expected `OnAppearing count: 2`, got `OnAppearing count: 1` **Root cause:** PR #29825 replaced `SendPop()` with manual stack synchronization (`SyncStackDownTo()`), which doesn't trigger navigation events. **Fix:** Simplified `DidPopItem` to use stack-sync detection: - Stacks in sync → Shell already handled pop → return early - Stacks out of sync → user-initiated (long-press) → call `SendPop()` **Key insight:** Tab tap updates Shell's stack BEFORE `DidPopItem` is called, but iOS long-press pops directly without notifying Shell first. **Regression chain:** | PR | What happened | |-----|---------------| | #24003 | Fixed #23892 with `_popRequested` flag | | #29825 | Removed flag, added `SyncStackDownTo()` - **broke long-press** | | #32456 | Added null checks, maintained broken state | | #33380 | **This PR** - simplified fix using stack-sync detection | **Removed:** `SyncStackDownTo()` method (44 lines) **What to avoid:** Don't remove stack count comparison - distinguishes user vs programmatic navigation. ### Issues Fixed Fixes #33379 **Related:** #23892, #29798 (verified not regressed ✅) --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ng Navigation.PushAsync - fix (#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…ts (#33380) ### Description of Change Fixes long-press back button navigation not triggering `OnAppearing` and other navigation events in Shell. **Problem:** Test expected `OnAppearing count: 2`, got `OnAppearing count: 1` **Root cause:** PR #29825 replaced `SendPop()` with manual stack synchronization (`SyncStackDownTo()`), which doesn't trigger navigation events. **Fix:** Simplified `DidPopItem` to use stack-sync detection: - Stacks in sync → Shell already handled pop → return early - Stacks out of sync → user-initiated (long-press) → call `SendPop()` **Key insight:** Tab tap updates Shell's stack BEFORE `DidPopItem` is called, but iOS long-press pops directly without notifying Shell first. **Regression chain:** | PR | What happened | |-----|---------------| | #24003 | Fixed #23892 with `_popRequested` flag | | #29825 | Removed flag, added `SyncStackDownTo()` - **broke long-press** | | #32456 | Added null checks, maintained broken state | | #33380 | **This PR** - simplified fix using stack-sync detection | **Removed:** `SyncStackDownTo()` method (44 lines) **What to avoid:** Don't remove stack count comparison - distinguishes user vs programmatic navigation. ### Issues Fixed Fixes #33379 **Related:** #23892, #29798 (verified not regressed ✅) --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ng Navigation.PushAsync - fix (#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…ng Navigation.PushAsync - fix (#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…ts (#33380) ### Description of Change Fixes long-press back button navigation not triggering `OnAppearing` and other navigation events in Shell. **Problem:** Test expected `OnAppearing count: 2`, got `OnAppearing count: 1` **Root cause:** PR #29825 replaced `SendPop()` with manual stack synchronization (`SyncStackDownTo()`), which doesn't trigger navigation events. **Fix:** Simplified `DidPopItem` to use stack-sync detection: - Stacks in sync → Shell already handled pop → return early - Stacks out of sync → user-initiated (long-press) → call `SendPop()` **Key insight:** Tab tap updates Shell's stack BEFORE `DidPopItem` is called, but iOS long-press pops directly without notifying Shell first. **Regression chain:** | PR | What happened | |-----|---------------| | #24003 | Fixed #23892 with `_popRequested` flag | | #29825 | Removed flag, added `SyncStackDownTo()` - **broke long-press** | | #32456 | Added null checks, maintained broken state | | #33380 | **This PR** - simplified fix using stack-sync detection | **Removed:** `SyncStackDownTo()` method (44 lines) **What to avoid:** Don't remove stack count comparison - distinguishes user vs programmatic navigation. ### Issues Fixed Fixes #33379 **Related:** #23892, #29798 (verified not regressed ✅) --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
…ng Navigation.PushAsync - fix (#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…ts (#33380) ### Description of Change Fixes long-press back button navigation not triggering `OnAppearing` and other navigation events in Shell. **Problem:** Test expected `OnAppearing count: 2`, got `OnAppearing count: 1` **Root cause:** PR #29825 replaced `SendPop()` with manual stack synchronization (`SyncStackDownTo()`), which doesn't trigger navigation events. **Fix:** Simplified `DidPopItem` to use stack-sync detection: - Stacks in sync → Shell already handled pop → return early - Stacks out of sync → user-initiated (long-press) → call `SendPop()` **Key insight:** Tab tap updates Shell's stack BEFORE `DidPopItem` is called, but iOS long-press pops directly without notifying Shell first. **Regression chain:** | PR | What happened | |-----|---------------| | #24003 | Fixed #23892 with `_popRequested` flag | | #29825 | Removed flag, added `SyncStackDownTo()` - **broke long-press** | | #32456 | Added null checks, maintained broken state | | #33380 | **This PR** - simplified fix using stack-sync detection | **Removed:** `SyncStackDownTo()` method (44 lines) **What to avoid:** Don't remove stack count comparison - distinguishes user vs programmatic navigation. ### Issues Fixed Fixes #33379 **Related:** #23892, #29798 (verified not regressed ✅) --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
## What's Coming .NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 27 commits with various improvements, bug fixes, and enhancements. ## CollectionView - [iOS][CV2] Fix page can be dragged down, and it would cause an extra space between Header and EmptyView text by @devanathan-vaithiyanathan in #31840 <details> <summary>🔧 Fixes</summary> - [I8_Header_and_Footer_Null - The page can be dragged down, and it would cause an extra space between Header and EmptyView text.](#31465) </details> - [iOS] Fixed the Items not displayed properly in CarouselView2 by @Ahamed-Ali in #31336 <details> <summary>🔧 Fixes</summary> - [[iOS] Items are not updated properly in CarouselView2.](#31148) </details> ## Docs - Improve Controls Core API docs by @jfversluis in #33240 ## Editor - [iOS] Fixed an issue where an Editor with a small height inside a ScrollView would cause the entire page to scroll by @Tamilarasan-Paranthaman in #27948 <details> <summary>🔧 Fixes</summary> - [[iOS][Editor] An Editor that has not enough height and resides inside a ScrollView/CollectionView will scroll the entire page](#27750) </details> ## Image - [Android] Image control crashes on Android when image width exceeds height by @KarthikRajaKalaimani in #33045 <details> <summary>🔧 Fixes</summary> - [Image control crashes on Android when image width exceeds height](#32869) </details> ## Mediapicker - [Android 🤖] Add a log telling why the request is cancelled by @pictos in #33295 <details> <summary>🔧 Fixes</summary> - [MediaPicker.PickPhotosAsync throwing TaskCancelledException in net10-android](#33283) </details> ## Navigation - [Android] Fix for App Hang When PopModalAsync Is Called Immediately After PushModalAsync with Task.Yield() by @BagavathiPerumal in #32479 <details> <summary>🔧 Fixes</summary> - [App hangs if PopModalAsync is called after PushModalAsync with single await Task.Yield()](#32310) </details> - [iOS 26] Navigation hangs after rapidly open and closing new page using Navigation.PushAsync - fix by @kubaflo in #32456 <details> <summary>🔧 Fixes</summary> - [[iOS 26] Navigation hangs after rapidly open and closing new page using Navigation.PushAsync](#32425) </details> ## Pages - [iOS] Fix ContentPage BackgroundImageSource not working by @Shalini-Ashokan in #33297 <details> <summary>🔧 Fixes</summary> - [.Net MAUI- Page.BackgroundImageSource not working for iOS](#21594) </details> ## RadioButton - [Issue-Resolver] Fix #33264 - RadioButtonGroup not working with Collection View by @kubaflo in #33343 <details> <summary>🔧 Fixes</summary> - [RadioButtonGroup not working with CollectionView](#33264) </details> ## SafeArea - [Android] Fixed Label Overlapped by Android Status Bar When Using SafeAreaEdges="Container" in .NET MAUI by @NirmalKumarYuvaraj in #33285 <details> <summary>🔧 Fixes</summary> - [SafeAreaEdges works correctly only on the first tab in Shell. Other tabs have content colliding with the display cutout in the landscape mode.](#33034) - [Label Overlapped by Android Status Bar When Using SafeAreaEdges="Container" in .NET MAUI](#32941) - [[MAUI 10] Layout breaks on first navigation (Shell // route) until soft keyboard appears/disappears (Android + iOS)](#33038) </details> ## ScrollView - [Windows, Android] Fix ScrollView Content Not Removed When Set to Null by @devanathan-vaithiyanathan in #33069 <details> <summary>🔧 Fixes</summary> - [[Windows, Android] ScrollView Content Not Removed When Set to Null](#33067) </details> ## Searchbar - Fix Android crash when changing shared Drawable tint on Searchbar by @tritter in #33071 <details> <summary>🔧 Fixes</summary> - [[Android] Crash on changing Tint of Searchbar](#33070) </details> ## Shell - [iOS] - Fix Custom FlyoutIcon from Being Overridden to Default Color in Shell by @prakashKannanSf3972 in #27580 <details> <summary>🔧 Fixes</summary> - [Change the flyout icon color](#6738) </details> - [iOS] Fix Shell NavBarIsVisible updates when switching ShellContent by @Vignesh-SF3580 in #33195 <details> <summary>🔧 Fixes</summary> - [[iOS] Shell NavBarIsVisible is not updated when changing ShellContent](#33191) </details> ## Slider - [C] Fix Slider and Stepper property order independence by @StephaneDelcroix in #32939 <details> <summary>🔧 Fixes</summary> - [Slider Binding Initialization Order Causes Incorrect Value Assignment in XAML](#32903) - [Slider is very broken, Value is a mess when setting Minimum](#14472) - [Slider is buggy depending on order of properties](#18910) - [Stepper Value is incorrectly clamped to default min/max when using bindableproperties in MVVM pattern](#12243) - [[Issue-Resolver] Fix #32903 - Sliderbinding initialization order issue](#32907) </details> ## Stepper - [Windows] Maui Stepper: Clamp minimum and maximum value by @OomJan in #33275 <details> <summary>🔧 Fixes</summary> - [[Windows] Maui Stepper is not clamped to minimum or maximum internally](#33274) </details> - [iOS] Fixed the UIStepper Value from being clamped based on old higher MinimumValue - Candidate PR test failure fix- 33363 by @Ahamed-Ali in #33392 ## TabbedPage - [windows] Fixed Rapid change of selected tab results in crash. by @praveenkumarkarunanithi in #33113 <details> <summary>🔧 Fixes</summary> - [Rapid change of selected tab results in crash on Windows.](#32824) </details> ## Titlebar - [Mac] Fix TitleBar Content Overlapping with Traffic Light Buttons on Latest macOS Version by @devanathan-vaithiyanathan in #33157 <details> <summary>🔧 Fixes</summary> - [TitleBar Content Overlapping with Traffic Light Buttons on Latest macOS Version](#33136) </details> ## Xaml - Fix for Control does not update from binding anymore after MultiBinding.ConvertBack is called by @BagavathiPerumal in #33128 <details> <summary>🔧 Fixes</summary> - [Control does not update from binding anymore after MultiBinding.ConvertBack is called](#24969) - [The issue with the MultiBinding converter with two way binding mode does not work properly when changing the values.](#20382) </details> <details> <summary>🔧 Infrastructure (1)</summary> - Avoid KVO on CALayer by introducing an Apple PlatformInterop by @albyrock87 in #30861 </details> <details> <summary>🧪 Testing (2)</summary> - [Testing] Enable UITest Issue18193 on MacCatalyst by @NafeelaNazhir in #31653 <details> <summary>🔧 Fixes</summary> - [Test Issue18193 was disabled on Mac Catalyst](#27206) </details> - Set the CV2 handlers as the default by @Ahamed-Ali in #33177 </details> <details> <summary>📦 Other (3)</summary> - Update WindowsAppSDK to 1.8 by @mattleibow in #32174 <details> <summary>🔧 Fixes</summary> - [Update to WindowsAppSDK](#30858) </details> - Fix command dependency reentrancy by @simonrozsival in #33129 - Fix SafeArea AdjustPan handling and add AdjustNothing mode tests by @PureWeen via @Copilot in #33354 </details> **Full Changelog**: main...inflight/candidate
…ng Navigation.PushAsync - fix (dotnet#32456) Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. |Before|After| |--|--| |<video src="https://github.com/user-attachments/assets/d63c59c1-8559-4d10-87d1-f1c8b67f8ea8" width="300px"></video>|<video src="https://github.com/user-attachments/assets/b5b6cf6c-29fb-4953-a9d7-f1f30988a3dc" width="300px"></video>| ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes dotnet#32425 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
…ts (dotnet#33380) ### Description of Change Fixes long-press back button navigation not triggering `OnAppearing` and other navigation events in Shell. **Problem:** Test expected `OnAppearing count: 2`, got `OnAppearing count: 1` **Root cause:** PR dotnet#29825 replaced `SendPop()` with manual stack synchronization (`SyncStackDownTo()`), which doesn't trigger navigation events. **Fix:** Simplified `DidPopItem` to use stack-sync detection: - Stacks in sync → Shell already handled pop → return early - Stacks out of sync → user-initiated (long-press) → call `SendPop()` **Key insight:** Tab tap updates Shell's stack BEFORE `DidPopItem` is called, but iOS long-press pops directly without notifying Shell first. **Regression chain:** | PR | What happened | |-----|---------------| | dotnet#24003 | Fixed dotnet#23892 with `_popRequested` flag | | dotnet#29825 | Removed flag, added `SyncStackDownTo()` - **broke long-press** | | dotnet#32456 | Added null checks, maintained broken state | | dotnet#33380 | **This PR** - simplified fix using stack-sync detection | **Removed:** `SyncStackDownTo()` method (44 lines) **What to avoid:** Don't remove stack count comparison - distinguishes user vs programmatic navigation. ### Issues Fixed Fixes dotnet#33379 **Related:** dotnet#23892, dotnet#29798 (verified not regressed ✅) --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling.
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
Add null checks in ShellSectionRenderer
Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling.
Screen.Recording.2025-11-09.at.00.01.52.mov
Screen.Recording.2025-11-08.at.23.59.30.mov
Issues Fixed
Fixes #32425