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

Conflicting recommendations check for ConsoleUI #4085

Merged
merged 4 commits into from
May 9, 2024

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented May 9, 2024

Problem

In ConsoleUI's recommendations screen for RP-1, Ctrl+A, F9 throws an exception:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.             │
   at CKAN.RelationshipResolver.AddModulesToInstall(CkanModule[] modules)
   at CKAN.ModuleInstaller.InstallList(ICollection`1 modules, RelationshipResolverOptions options, RegistryManager registry_manager, HashSet`1& possibleConfigOnlyDirs, IDownloader downloader, Boolean ConfirmPrompt)
   at CKAN.ConsoleUI.InstallScreen.Run(ConsoleTheme theme, Action`1 process)
   at CKAN.ConsoleUI.ModListScreen.ApplyChanges(ConsoleTheme theme)
   at CKAN.ConsoleUI.ModListScreen.<>c__DisplayClass0_0.<.ctor>b__27(Object sender, ConsoleTheme theme)
   at CKAN.ConsoleUI.Toolkit.ScreenContainer.Interact(ConsoleTheme theme)
   at CKAN.ConsoleUI.Toolkit.ScreenContainer.Run(ConsoleTheme theme, Action`1 process)
   at CKAN.ConsoleUI.ConsoleCKAN..ctor(GameInstanceManager mgr, String themeName, Boolean debug)
   at CKAN.ConsoleUI.ConsoleUI.Main_(GameInstanceManager manager, String themeName, Boolean debug)
   at CKAN.CmdLine.MainClass.RunSimpleAction(Options cmdline, CommonOptions options, String[] args, IUser user, GameInstanceManager manager)
   at CKAN.CmdLine.MainClass.Execute(GameInstanceManager manager, CommonOptions opts, String[] args)
   at CKAN.CmdLine.MainClass.Main(String[] args)

Note that I had to turn off "Enable Ctrl key shortcuts" in the Windows terminal settings to allow Ctrl+A to reach the app code.

image

Cause

#4023 updated the install screen to find the latest module versions that don't conflict with any of the other modules. In the case of unavoidable conflicts, there may be no such version, so null values were sneaking into the list of mods to install.

Motivation

In ConsoleUI, the recommendations screen leaves conflict checking to the install screen, so the user can select whatever recommended/suggested modules they want, only to find out that some combinations can't actually be installed.

Changes

  • Now the install screen's allowed-module logic will fall back to the original module in case of conflicts. (But also this will no longer happen, see below.)

  • Now the ConsoleUI recommendations screen checks for conflicts when you:

    • Select a row
      image
    • Select all with Ctrl+A
      image
    • Commit changes with F9

    In each case, if any conflicts are found, the user will be alerted and the proximate action will be cancelled (i.e., the mod won't be added to the list). This will mean that you can no longer leave this screen with a conflicting changeset, and the warning will appear at a time when you can do something about it.

Fixes #4072.

@HebaruSan HebaruSan added Bug Something is not working as intended Enhancement New features or functionality Relationships Issues affecting depends, recommends, etc. ConsoleUI Issues affecting the interactive console UI labels May 9, 2024
@HebaruSan HebaruSan merged commit 88d208f into KSP-CKAN:master May 9, 2024
8 checks passed
@HebaruSan HebaruSan deleted the fix/consoleui-confl-recs branch May 9, 2024 19:19
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 ConsoleUI Issues affecting the interactive console UI Enhancement New features or functionality Relationships Issues affecting depends, recommends, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConsoleUI should check for conflicts between chosen recommendations and suggestions, plus a crash
1 participant