Project

General

Profile

Bug #28036

Game hangs if duplicated mods are detected

Added by IgorZ almost 3 years ago. Updated over 2 years ago.

Status:
New
Severity:
Low
Assignee:
-
Category:
Regression
Target version:
-
Start date:
06/25/2021
% Done:

0%

Version:
Platform:
Windows
Expansion:
Core Game
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

Steps to reproduce:
1. Have ANY DLL be existing twice within the `GameData` folder. E.g. you may copy `ModuleManager.4.1.4.dll` into any arbitrary location under `GameData` folder. The requirement is to have two or more copies of the same DLL.
2. Try to load the game.

Observed behavior:
1. The game hangs and doesn't load.
2. The logs would have a record:

[EXC 00:48:56.413] ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <9577ac7a62ef43179789031239ba8798>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) (at <9577ac7a62ef43179789031239ba8798>:0)
AssemblyLoader.FlagDuplicatedPlugins () (at <a1ca58b5ca7140639de29a81de5e3f32>:0)
GameDatabase+<LoadObjects>d__90.MoveNext () (at <a1ca58b5ca7140639de29a81de5e3f32>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
<CreateDatabase>d__71:MoveNext()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
GameDatabase:StartLoad()
<LoadSystems>d__11:MoveNext()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
LoadingScreen:Start()

History

#1 Updated by IgorZ almost 3 years ago

Clarified. In order to trigger this bug there should be two pairs of the duplicated mods. I.e. make a duplication of `ModuleManager.4.1.4.dll` and then choose another mod and make duplication for it too. The system works fine if only one duplicated mod is detected.

#2 Updated by IgorZ almost 3 years ago

FYI. Such mods like KIS and KAS cannot be be used in KSP 1.12 anymore due to this bug. And this is not the only mods affected. Basically, anything that uses the shared DLLs (like MiniAVC-V2.dll) would make the game hanging.

#3 Updated by gotmachine over 2 years ago

Still happening in 1.12.2
This is a huge issue with absolutely zero workarounds. There are many mods packaging common dependencies (nuget packages, unity/mono assemblies like System.IO.Compression) or providing redistribuable API assemblies.

Note that contrary to IgorZ comment, the error doesn't happen consistently, it is dependent on the assemblies load order.
In some cases, AssemblyLoader.FlagDuplicatedPlugins() won't fail with an ArgumentOutOfRangeException, but it will still remove random assemblies from its internal list.

#4 Updated by IgorZ over 2 years ago

gotmachine wrote:

Note that contrary to IgorZ comment, the error doesn't happen consistently, it is dependent on the assemblies load order.

Yeah, with more testing around it I've figured it's about the mods loading order. Sometimes duplicates got removed successfully, but sometimes the game hangs. And there is on way to predict it. I ended up re-compiling all my shared DLLs with different names for each mod. This is the only way to stop deduplication logic to break the game.

Also available in: Atom PDF