diff --git a/CHANGELOG.md b/CHANGELOG.md index 62956ff..ea87481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Installed (Velopack) builds crashed on launch with a blank window — the published app + was missing its resource index (`resources.pri`), so the first screen failed with a + XAML parsing error. The published build now ships the app's resources correctly, and + launches as expected. Running from Visual Studio was unaffected. +- The system tray menu's "Show Snipdeck" and "Exit" entries did nothing when clicked. + They now work. + ## [1.0.2] - 2026-06-08 ### Added diff --git a/src/Snipdeck.App/CrashLog.cs b/src/Snipdeck.App/CrashLog.cs index ef8962f..5a45bc1 100644 --- a/src/Snipdeck.App/CrashLog.cs +++ b/src/Snipdeck.App/CrashLog.cs @@ -1,5 +1,4 @@ using System.Globalization; -using System.Runtime.InteropServices; using System.Text; using Microsoft.Extensions.DependencyInjection; @@ -88,11 +87,8 @@ private static void AppendException(StringBuilder sb, Exception ex, int depth) var indent = new string(' ', depth * 2); _ = sb.Append(indent).Append("Type: ").AppendLine(ex.GetType().FullName ?? ex.GetType().Name); - if (ex is COMException) - { - _ = sb.Append(indent).Append("HRESULT: 0x") - .AppendLine(ex.HResult.ToString("X8", CultureInfo.InvariantCulture)); - } + _ = sb.Append(indent).Append("HRESULT: 0x") + .AppendLine(ex.HResult.ToString("X8", CultureInfo.InvariantCulture)); _ = sb.Append(indent).Append("Message: ").AppendLine(ex.Message); if (!string.IsNullOrEmpty(ex.Source)) { @@ -106,6 +102,13 @@ private static void AppendException(StringBuilder sb, Exception ex, int depth) _ = sb.Append(indent).Append(" ").AppendLine(line.TrimEnd('\r')); } } + // WinRT-sourced exceptions (e.g. XamlParseException) carry the real + // detail here, not in Message — the RestrictedDescription is what + // names the missing resource / failing element. + foreach (System.Collections.DictionaryEntry entry in ex.Data) + { + _ = sb.Append(indent).Append("Data[").Append(entry.Key).Append("]: ").AppendLine(entry.Value?.ToString()); + } if (ex.InnerException is not null) { _ = sb.Append(indent).AppendLine("Inner:"); diff --git a/src/Snipdeck.App/Services/HNotifyIconTrayService.cs b/src/Snipdeck.App/Services/HNotifyIconTrayService.cs index e2e639e..290e03e 100644 --- a/src/Snipdeck.App/Services/HNotifyIconTrayService.cs +++ b/src/Snipdeck.App/Services/HNotifyIconTrayService.cs @@ -57,38 +57,40 @@ public void Dispose() private MenuFlyout BuildContextMenu() { - var showItem = new MenuFlyoutItem { Text = "Show Snipdeck" }; - showItem.Click += OnShowItemClick; - - var exitItem = new MenuFlyoutItem { Text = "Exit" }; - exitItem.Click += OnExitItemClick; - + // In an unpackaged app H.NotifyIcon's default context menu is a native + // Win32 PopupMenu, built from this MenuFlyout by invoking each item's + // Command — it does NOT raise the WinUI routed Click event. So the menu + // items must use Command (like LeftClickCommand does), not Click, or + // they silently do nothing. return new MenuFlyout { Items = { - showItem, + new MenuFlyoutItem + { + Text = "Show Snipdeck", + Command = new RelayCommand(RaiseShowRequested), + }, new MenuFlyoutSeparator(), - exitItem, + new MenuFlyoutItem + { + Text = "Exit", + Command = new RelayCommand(RaiseExitRequested), + }, }, }; } - private void OnShowItemClick(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) + private void RaiseShowRequested() { - RaiseShowRequested(); + ShowRequested?.Invoke(this, EventArgs.Empty); } - private void OnExitItemClick(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) + private void RaiseExitRequested() { ExitRequested?.Invoke(this, EventArgs.Empty); } - private void RaiseShowRequested() - { - ShowRequested?.Invoke(this, EventArgs.Empty); - } - private sealed partial class RelayCommand(Action execute) : System.Windows.Input.ICommand { #pragma warning disable CS0067 // 'CanExecuteChanged' is never used — relay never changes. diff --git a/src/Snipdeck.App/Snipdeck.App.csproj b/src/Snipdeck.App/Snipdeck.App.csproj index 00c2205..96f9068 100644 --- a/src/Snipdeck.App/Snipdeck.App.csproj +++ b/src/Snipdeck.App/Snipdeck.App.csproj @@ -11,6 +11,18 @@ false None true + + true + + resources.pri x64