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 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-10-27 18:39:27 -04:00
1 parent bc15c362e1
commit d505a50934
2 files changed
+8 -2

No files matched your search

+2 -2
View File
@@ -5,8 +5,8 @@ using System.Windows.Forms;
namespace OpenNest.Forms
{
/// <summary>
/// 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.
/// </summary>
internal sealed class UpdaterStatus : IDisposable
+6
View File
@@ -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);