Skip to content

The maui app quit and no errors in error list after editing ResourceDictionary XAML file on iOS Simulator with MAUI SR6 10.0.60 #35018

Description

@noiseonwires

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

  1. Create a new MAUI project in VS
  2. Update the package:
  3. Open Resource > Styles > Styles.xaml
  4. Find the Label Style with x:Key="Headline" around line 175 and change the TextColor value to Red
  5. Start Debugging on iOS Simulator
  6. Go to Label Style with x:Key="Headline" and change the "Headline" to "Headline2"
  7. 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

Metadata

Metadata

Labels

i/regressionThis issue described a confirmed regression on a currently supported versionplatform/iosregressed-in-10.0.60s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions