Skip to content

Fix "Version upgrade failed" popup on fresh configs (inverted null check) - #40

Open
HendoBuilds wants to merge 1 commit into
Dimencia:masterfrom
HendoBuilds:fix-version-check-null-branch
Open

Fix "Version upgrade failed" popup on fresh configs (inverted null check)#40
HendoBuilds wants to merge 1 commit into
Dimencia:masterfrom
HendoBuilds:fix-version-check-null-branch

Conversation

@HendoBuilds

Copy link
Copy Markdown

Saw a new user in the Bards Guild lutebot-help channel hit the "Version upgrade failed" popup on a fresh install and conclude the download itself was broken, so I dug into the source. The branches of this check in DetectVersionChange (LuteBotForm.cs) are swapped:

string lastVersion;
if (string.IsNullOrWhiteSpace(ConfigManager.GetProperty(PropertyItem.LastVersion)))
    lastVersion = ConfigManager.GetProperty(PropertyItem.LastVersion);
else
    lastVersion = "0.0.0";

Two effects:

  1. Fresh config (LastVersion is "" per DefaultConfig.txt): lastVersion stays "", so IsVersionGreater("3.6.0", "") hits int.Parse("") and throws, which triggers the "Version upgrade failed" message box. Because the throw skips the SetProperty(PropertyItem.LastVersion, ...) at the end of the method, LastVersion never gets written, so the popup repeats on every launch. LuteBot still works after dismissing it, but it reads like a broken install to new users.
  2. Existing config with a real LastVersion value: lastVersion becomes "0.0.0", so every upgrade action runs on every launch, including Instrument.Write(true), which resets customized instruments to defaults each start.

This PR swaps the two branches, so a blank LastVersion is treated as 0.0.0 (upgrade actions run once, then the version is recorded) and a stored version is used as-is.

Heads up that I reviewed the change but could not compile it here (no .NET toolchain on this machine); it is a straight swap of the two existing branch expressions.

Thanks for maintaining this!

🤖 Generated with Claude Code

The branches of the IsNullOrWhiteSpace check were swapped: a fresh
config (LastVersion = "") kept the blank string, so IsVersionGreater
hit int.Parse("") and threw, showing the "Version upgrade failed"
popup on every launch. A stored version was replaced with "0.0.0",
re-running every upgrade action (and resetting customized instruments
to defaults) on each start.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HendoBuilds

Copy link
Copy Markdown
Author

Update: I've now built and tested this properly on Windows rather than just reviewing it. I tested both unpatched master and this branch, same four scenarios, checking window titles and config state after each run:

Unpatched master

  1. Fresh config (no %APPDATA%\LuteBot): the "Version upgrade failed" popup appears, and because the throw skips the LastVersion write it appears again on every launch (verified with a second run).
  2. Existing config with LastVersion 3.6.4 and a customized Instruments.json: the customization is wiped on launch, even though no upgrade action applies to 3.6.4.

This branch, same scenarios
3. Fresh config: no popup, DetectVersionChange completes (title updates to LuteBot v3.6.5), and LastVersion is recorded as 3.6.5 so upgrade actions won't re-run.
4. Existing 3.6.4 config with customized Instruments.json: the customization survives and LastVersion updates to 3.6.5.

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.

1 participant