Fix installed-build launch crash (resources.pri) and dead tray menu items#58
Merged
Merged
Conversation
Published (Velopack) builds crashed at startup with a XamlParseException on the first app-specific page (ShellPage), while running from Visual Studio worked. Root cause: the self-contained Release publish shipped no app resources.pri. Two compounding defects: - `dotnet publish` generated the app's PRI into bin but never copied it to the publish output, because the WinUI PRI/packaging targets weren't imported. `EnableMsixTooling=true` (required for unpackaged self-contained WinUI per the Windows App SDK docs) wires in the copy-to-publish step. - An unpackaged app's runtime auto-loads only `resources.pri` from the exe directory, but the build names the app PRI after the assembly (Snipdeck.App.pri), which the runtime never loads. `ProjectPriFileName` pins the conventional name. See microsoft-ui-xaml#10856. Verified on the Win11 build host: with both set, the published self-contained Release build (R2R on, exact CI config) ships resources.pri and launches to the shell instead of crashing. Also surface HRESULT and Exception.Data on every logged exception in CrashLog — the XamlParseException's RestrictedDescription in Data is what pinpointed the missing resource (Message was only "XAML parsing failed"). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The tray "Show Snipdeck" and "Exit" menu items did nothing when clicked. In an unpackaged app H.NotifyIcon's default context menu is a native Win32 PopupMenu, built from the MenuFlyout by invoking each item's Command — it does not raise the WinUI routed Click event the items were wired to. (The left-click action worked because it already used a Command.) Drive the items via the existing RelayCommand instead of Click handlers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merged
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.
Two fixes for the installed (Velopack) build. Both verified on the Win11 build host with the exact CI release config (
dotnet publish -c Release -r win-x64 --self-contained true, R2R on); a raw published exe was launched interactively (the launch crash isn't reproducible from a VS Debug run).1. Installed builds crashed on launch — missing
resources.priInstalled builds crashed on launch on multiple machines with a blank window; the crash log showed a
XamlParseExceptionatShellPage..ctor→LoadComponentwith no inner exception. VS Debug was unaffected.Root cause: the self-contained Release publish shipped no app
resources.pri— only the WindowsAppSDK framework PRIs. With the app's resource index absent,ms-appx:///lookups for the app's own XAML failed. App.xaml limped through on the framework PRIs (so the app reachedOnLaunched); the first app-specific page (ShellPage) died.Enriching
CrashLogto dumpHRESULT+Exception.Datasurfaced the real error (not inMessage):Two compounding defects:
binbut dropped bydotnet publish, because the WinUI PRI/packaging targets weren't imported.EnableMsixTooling=true(required for unpackaged self-contained WinUI per the Windows App SDK docs) wires in the copy-to-publish step.resources.prifrom the exe dir, but the build names it after the assembly (Snipdeck.App.pri), which the runtime never loads.ProjectPriFileNamepins the conventional name. See microsoft-ui-xaml#10856.After: publish ships
resources.pri(1.4 MB, all XBF); the app launches to the shell. (Ruled out R2R along the way — both R2R on/off crashed identically.)2. Tray menu "Show Snipdeck" and "Exit" did nothing
In an unpackaged app, H.NotifyIcon's default context menu is a native Win32 PopupMenu, built from the
MenuFlyoutby invoking each item'sCommand— it does not raise the WinUI routedClickevent the items were wired to. (Left-click worked because it already used aCommand.) Switched the items to the existingRelayCommand.Diagnostics
CrashLognow always logsHRESULTandException.Data— the WinRTRestrictedDescriptioninDatais what pinpointed the missing resource (Messagewas only "XAML parsing failed").🤖 Generated with Claude Code