From d505a50934516a29a6b7a1cca76fdaa90feed7d1 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 27 Oct 2026 18:39:27 -0400 Subject: [PATCH] fix(update): skip update checks when no Velopack locator is set With GitHub as the default source, UpdaterService always built an UpdateManager, which throws unless VelopackApp.Build().Run() has set a locator. MainApp does, but WinForms test hosts constructing MainForm do not, so 78 OpenNest.WinForms.Tests failed. Without a locator there is no installation to update, so the service now stays idle. Co-Authored-By: Claude Opus 5.5 --- OpenNest/Forms/UpdaterStatus.cs | 4 ++-- OpenNest/UpdaterService.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenNest/Forms/UpdaterStatus.cs b/OpenNest/Forms/UpdaterStatus.cs index c639d82d..c08d1be2 100644 --- a/OpenNest/Forms/UpdaterStatus.cs +++ b/OpenNest/Forms/UpdaterStatus.cs @@ -5,8 +5,8 @@ using System.Windows.Forms; namespace OpenNest.Forms { /// - /// Background update checks against the per-machine feed URL (Options dialog; blank - /// disables checks) and the status-bar item that announces a downloaded update. Never + /// Background update checks (GitHub Releases, or the per-machine feed URL from the + /// Options dialog) and the status-bar item that announces a downloaded update. Never /// restarts on its own: it restarts only when the user clicks the item and confirms. /// internal sealed class UpdaterStatus : IDisposable diff --git a/OpenNest/UpdaterService.cs b/OpenNest/UpdaterService.cs index 1f5a91fa..ae12e362 100644 --- a/OpenNest/UpdaterService.cs +++ b/OpenNest/UpdaterService.cs @@ -3,6 +3,7 @@ using System.Threading; using System.Threading.Tasks; using OpenNest.Properties; using Velopack; +using Velopack.Locators; using Velopack.Sources; namespace OpenNest @@ -38,6 +39,11 @@ namespace OpenNest public UpdaterService(string feedUrl, bool includeDevBuilds) { + // Only a process started through VelopackApp (MainApp) has a locator; + // test hosts and other embedders get no update checks. + if (!VelopackLocator.IsCurrentSet) + return; + IUpdateSource source = string.IsNullOrWhiteSpace(feedUrl) ? new GithubSource(GitHubRepositoryUrl, null, includeDevBuilds) : new SimpleWebSource(feedUrl);