Skip to content

Fix Windows toolbar image updates with Prism - #3449

Merged
dansiegel merged 2 commits into
masterfrom
fix/3448-toolbar-icon
Oct 15, 2026
Merged

dansiegel merged 2 commits into
masterfrom
fix/3448-toolbar-icon

Conversation

@dansiegel

Copy link
Copy Markdown
Member

Description of Change

On Windows, changing a toolbar item's image can briefly leave the new image source without a parent. MAUI then falls back to application services, where DryIoc can auto-construct an unusable WinUI Window. Image conversion throws when MAUI requests its display density.

Register an optional null native window at application scope on Windows. MAUI's window contexts continue to supply their actual windows, and TryAddSingleton preserves explicit registrations.

Validation:

  • Two Windows service tests in the existing MAUI DryIoc test project pass on MAUI 10.0.10. They cover the optional lookup through the real Prism builder/container and preservation of an explicit registration. The lookup test fails without the fix because DryIoc constructs a native window.
  • All 275 existing portable MAUI DryIoc tests pass on .NET 10.
  • Separate local native runtime checks passed on MAUI 10.0.10 and 10.0.20, using both normal Prism startup and plain MAUI window creation. They verified rendered toolbar images through repeated resource-dictionary swaps, direct source replacement, clearing, and restoration. These rendering checks are not part of the committed headless test suite.

Bugs Fixed

API Changes

None.

Behavioral Changes

None beyond the bug fix.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T20:16:23.359643Z 9f16fd1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dansiegel
dansiegel merged commit 2104728 into master Oct 15, 2026
4 checks passed
@dansiegel
dansiegel deleted the fix/3448-toolbar-icon branch October 15, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Windows - NullReferenceException when ToolbarItem.IconImageSource changes after UsePrism is registered

1 participant