Skip to content

fix: compile SelectorBar.xaml as a Page to prevent rare startup crash#617

Open
haoliuu wants to merge 1 commit into
mainfrom
haoliu/fix-selectorbar-startup-crash
Open

fix: compile SelectorBar.xaml as a Page to prevent rare startup crash#617
haoliuu wants to merge 1 commit into
mainfrom
haoliu/fix-selectorbar-startup-crash

Conversation

@haoliuu

@haoliuu haoliuu commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

SelectorBar.xaml was excluded from XAML compilation (<Page Remove> in the csproj) and shipped as a loose Content file. Since App.xaml merges it as a resource dictionary (<ResourceDictionary Source="/Styles/SelectorBar.xaml" />), the framework had to resolve it at runtime via ms-resource:///Files/Styles/SelectorBar.xaml. In rare cases that runtime lookup can fail at startup, throwing during App.xaml parsing and crashing the app before any UI loads.

This has been present since the app's initial release. Every other Styles/*.xaml dictionary is a compiled/embedded Page - SelectorBar was the only one on this runtime-lookup path.

Fix

Removed the <Page Remove="Styles\SelectorBar.xaml" /> so the file compiles into an embedded XBF like every other style dictionary. App.xaml now binds to the embedded compiled resource instead of a runtime file lookup, eliminating the failure mode.

Related to #61457801

Verification

  • Build succeeds with 0 errors.
  • Confirmed Styles\SelectorBar.xbf is now produced and embedded (listed in embed.resfiles alongside Button, ComboBox, NavigationView).
  • App launches and the home page renders normally.

Copilot AI review requested due to automatic review settings July 8, 2026 02:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a rare WinUI 3 startup crash by ensuring Styles/SelectorBar.xaml is XAML-compiled (embedded XBF) like the other merged style dictionaries, avoiding a runtime resource-file lookup during App.xaml parsing.

Changes:

  • Removed the project file rule that excluded Styles\SelectorBar.xaml from XAML compilation (<Page Remove=...>), allowing it to be compiled/embedded.

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.

3 participants