Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect upgradeable mods from being displayed as uninstalled #3944

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

HebaruSan
Copy link
Member

Problem

The fix for installed mods showing up as not installed from #3934 was incomplete; it addressed installed mods that can't be upgraded, but the problem can still happen for installed mods that are upgradeable. If such a mod happens to load as uninstalled and you try to upgrade it, an exception is thrown:

image

Reported by @jan-bures on Discord.

Cause

I used .Except() to filter installed mods out of the compatible and incompatible lists, but that only works when their CkanModule.version properties are the same. For an upgradeable mod, its version in the compatible list is newer than the installed verson, so .Except() doesn't filter it out, and we once again have a race condition.

Changes

  • Now we filter by identifier instead. (Unfortunately, .ExceptBy() is not available until .NET 6+).
  • Also switched a bunch of new type[0] expressions to Array.Empty<type>() because this was recommended by VSCode at some point.

I'll self-review this since it's small and familiar, and so we can consider a quick hotfix release before KSP2 0.2.0.0 comes out.

@HebaruSan HebaruSan added Bug Something is not working as intended GUI Issues affecting the interactive GUI labels Dec 14, 2023
@HebaruSan HebaruSan merged commit a79f1c9 into KSP-CKAN:master Dec 14, 2023
8 checks passed
@HebaruSan HebaruSan deleted the fix/upgradeable-uninstalled branch December 14, 2023 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant