Description
Note:
This issue doesn't reproduce with MAUI 10.0.20, 10.0.50.
This issue doesn't reproduce on windows and android platform.
Root Cause
Regression: PR #33859 (commit 6874c80) changed StaticResourceExtension.ProvideValue to always throw XamlParseException for missing resources, even during Hot Reload. Previously it returned null when ExceptionHandler2 was set. This change is correct for app launch consistency, but exposes an iOS-specific weakness.
iOS-specific problem: During Legacy XAML Hot Reload, the TAP rebuilds the Shell by calling Shell.InitializeComponent(). On iOS, this synchronously triggers:
→ iOS ShellItemRenderer.CreateTabRenderers()
→ UpdateTabBarHidden()
→ UIKit sets TabBarHidden (native property)
→ UIKit calls ViewDidLoad() synchronously
→ ShellSectionRootRenderer.LoadRenderers()
→ GetOrCreateContent() → MainPage constructor
→ StaticResourceExtension.ProvideValue()
→ XamlParseException("StaticResource not found for key Headline")
The exception is thrown inside a UIKit lifecycle callback. While ShellRenderer.OnCurrentItemChanged() has a try/catch, the Shell is left in a corrupted state (no renderer for current item), causing the app to terminate.
Why Android/Windows don't crash: Android creates page content lazily (Fragment OnCreateView only when displayed). Windows uses a managed handler framework. Neither triggers synchronous page construction during Shell item setup.
Proposed fix
Wrap all GetOrCreateContent() calls in the iOS ShellSectionRootRenderer with try/catch. Failed pages are skipped and logged, matching the inherently-deferred behavior on Android/Windows. The ExceptionHandler2 callback still fires before the throw, so errors will be reported to the IDE.
So in src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellSectionRootRenderer.cs
we probably need to protect
- ShowNavBar property getter
- ViewDidLoad() tracker page assignment
- LoadRenderers() — both loops
- OnShellSectionItemsChanged() new items loop
Steps to Reproduce
- Create a new MAUI project in VS
- Update the package:
- Open Resource > Styles > Styles.xaml
- Find the Label Style with x:Key="Headline" around line 175 and change the TextColor value to Red
- Start Debugging on iOS Simulator
- Go to Label Style with x:Key="Headline" and change the "Headline" to "Headline2"
- Click Hot Reload button
Actual Result:
The maui app quit and no errors in error list.
Expected Result:
In the app, the Hello World text is not red anymore, and it is the wrong size
The error "StaticResource not found for key Headline" should also appear on the error list.
Version with bug
11.0.0-preview2
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
10.0.50
Affected platforms
iOS
Description
Note:
This issue doesn't reproduce with MAUI 10.0.20, 10.0.50.
This issue doesn't reproduce on windows and android platform.
Root Cause
Regression: PR #33859 (commit 6874c80) changed StaticResourceExtension.ProvideValue to always throw XamlParseException for missing resources, even during Hot Reload. Previously it returned null when ExceptionHandler2 was set. This change is correct for app launch consistency, but exposes an iOS-specific weakness.
iOS-specific problem: During Legacy XAML Hot Reload, the TAP rebuilds the Shell by calling Shell.InitializeComponent(). On iOS, this synchronously triggers:
The exception is thrown inside a UIKit lifecycle callback. While ShellRenderer.OnCurrentItemChanged() has a try/catch, the Shell is left in a corrupted state (no renderer for current item), causing the app to terminate.
Why Android/Windows don't crash: Android creates page content lazily (Fragment OnCreateView only when displayed). Windows uses a managed handler framework. Neither triggers synchronous page construction during Shell item setup.
Proposed fix
Wrap all GetOrCreateContent() calls in the iOS ShellSectionRootRenderer with try/catch. Failed pages are skipped and logged, matching the inherently-deferred behavior on Android/Windows. The ExceptionHandler2 callback still fires before the throw, so errors will be reported to the IDE.
So in src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellSectionRootRenderer.cs
we probably need to protect
Steps to Reproduce
Actual Result:
The maui app quit and no errors in error list.
Expected Result:
In the app, the Hello World text is not red anymore, and it is the wrong size
The error "StaticResource not found for key Headline" should also appear on the error list.
Version with bug
11.0.0-preview2
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
10.0.50
Affected platforms
iOS