-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Don't throw exceptions for dependency conflicts #2766
Conversation
On your branch, if I select RO and KJR Continued, KJR Continued and KJR Next are highlighted red, but not Realism Overhaul, as in your screenshot. |
Hmm, I think the last time we saw Windows display that window for an exception and Mono not, the exception was still being thrown in both and just not displayed in Mono. I think that would explain the lack of row highlights on master—the code that sets up the conflict to mark the rows doesn't run because the exception is thrown first. For the second thing, can you set that up and then click the "X" to quit and then screenshot the "are you sure" popup? That gives a few clues as to what the found conflicts are. Otherwise I'll take a look in Linux in a bit. |
Thanks! So it is including RO in the list of conflicts, it's just not coloring the row. I'll see if I can figure that out... |
Yep! That's it! |
Yeah, the code in Lines 101 to 118 in b996c59
Luckily we already have |
OK, the latest commit should fix that issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works! No more errors thrown, a little bit of red paint here and there, even after changing filters, perfect!
Problem
If you try to select both RealismOverhaul and KerbalJointReinforcementNext to be installed, this exception is thrown:
Found while looking into KSP-CKAN/NetKAN#7203, though this may or may not be related to the issues described there.
Cause
RO depends on KJRContinued, which conflicts with KJRNext.
Prior to #2660, a conflict between a module to be installed and a dependency would be caught here:
CKAN/Core/Relationships/RelationshipResolver.cs
Lines 477 to 487 in 19f7302
After #2660, we check conflicts in
LatestAvailableWithProvides
, so the conflict with the dependency causes this block to find zero candidates:CKAN/Core/Relationships/RelationshipResolver.cs
Lines 409 to 412 in 19f7302
So this throws:
CKAN/Core/Relationships/RelationshipResolver.cs
Lines 414 to 420 in 19f7302
The calling code isn't expecting exceptions because it sets its options to suppress them:
CKAN/GUI/MainModList.cs
Lines 1026 to 1032 in 19f7302
Changes
Now if the initial search for candidates comes up empty, we try again without passing the mod list (which is how it worked prior to #2660, the mod list was ignored until later). This will still allow us to find non-conflicting older versions of a module when necessary (in the first pass), while allowing dependency conflicts to be handled without throwing exceptions (in the second pass).
Highlighting hidden conflicts
As a side fix, if you filter the list and then select a mod to install that has a conflict with a hidden mod (the RealismOverhaul / KJRNext combo above is easy for this), only the conflicting rows that were currently visible would be highlighted with a red background. The invisible ones would remain white, including after the filter was changed to make them visible again.
Now all conflicts are highlighted red regardless of whether they're visible. As a side effect of this, the conflict marking code is slightly more efficient, because it no longer needs to loop over every visible row.