Skip to content

fix: load preferences before Host.StartAsync to preserve UpdateChannel#537

Merged
rygel merged 1 commit intomainfrom
fix/update-channel-startup-order
Apr 5, 2026
Merged

fix: load preferences before Host.StartAsync to preserve UpdateChannel#537
rygel merged 1 commit intomainfrom
fix/update-channel-startup-order

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Apr 5, 2026

Summary

The UpdateChannel preference (Stable/Beta) was silently reset to Stable on every startup because preferences were loaded after Host.StartAsync(), but the GitHubUpdateChecker DI singleton captured Preferences.UpdateChannel during service construction inside Host.StartAsync(). At that point, Preferences was still the default new AppPreferences() (Stable).

Fix: Move preferencesStore.LoadAsync() before Host.StartAsync() so the DI singleton captures the correct channel from disk.

This is safe because Host.Services is available after the constructor's .Build() call — StartAsync() only starts hosted services, not the DI container.

Test plan

  • dotnet build — 0 errors
  • 1125/1127 tests pass (2 pre-existing file-lock flakes)
  • Manual: set channel to Beta in settings, restart app, verify Beta is still selected

🤖 Generated with Claude Code

Preferences were loaded AFTER Host.StartAsync(), but the
GitHubUpdateChecker DI singleton captured Preferences.UpdateChannel
during Host.StartAsync(). Since Preferences was still the default
(Stable) at that point, the singleton always started with Stable
regardless of what was persisted on disk.

Move preferences loading before Host.StartAsync() so the DI singleton
captures the correct channel from disk (e.g. Beta).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rygel rygel merged commit 1df49c2 into main Apr 5, 2026
17 of 18 checks passed
@rygel rygel deleted the fix/update-channel-startup-order branch April 5, 2026 10:43
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.

2 participants