fix: compile SelectorBar.xaml as a Page to prevent rare startup crash#617
Open
haoliuu wants to merge 1 commit into
Open
fix: compile SelectorBar.xaml as a Page to prevent rare startup crash#617haoliuu wants to merge 1 commit into
haoliuu wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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.xamlfrom XAML compilation (<Page Remove=...>), allowing it to be compiled/embedded.
weiyuanyue
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SelectorBar.xamlwas 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 viams-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/*.xamldictionary is a compiled/embedded Page -SelectorBarwas 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
Styles\SelectorBar.xbfis now produced and embedded (listed inembed.resfilesalongsideButton,ComboBox,NavigationView).