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

Mods that have more than one DLL do not load #133

Open
AMacro opened this issue Jan 23, 2024 · 8 comments
Open

Mods that have more than one DLL do not load #133

AMacro opened this issue Jan 23, 2024 · 8 comments

Comments

@AMacro
Copy link

AMacro commented Jan 23, 2024

When a mod loads a DLL from the mod directory, it does not appear to load and throws a `System.IO.FileNotFoundException: Could not load file or assembly '' exception.

For example, RuntimeUnityEditor has 2 DLLs 'RuntimeUnityEditor.UMM.dll' and 'RuntimeUnityEditor.Core.dll' - the RUE.UMM dll has a static reference to the RUE.Core dll.

When UMM attempts to load RUE, the error occurs and the following log is produced:

[Manager] Starting.
[Manager] Parsing mods.
[Manager] Reading file 'C:\Program Files (x86)\Steam\steamapps\common\Railroader\Mods\RuntimeUnityEditor\Info.json'.
[Manager] Sorting mods.
[Manager] Loading mods.
[RuntimeUnityEditor] Version '5.2.1.0'. Loading.
[RuntimeUnityEditor] [Error] Error loading file 'C:\Program Files (x86)\Steam\steamapps\common\Railroader\Mods\RuntimeUnityEditor\RuntimeUnityEditor.UMM.dll'.
[RuntimeUnityEditor] [Exception] ReflectionTypeLoadException - Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not load file or assembly 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Could not load file or assembly 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not load file or assembly 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Could not load file or assembly 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <7e05db41a20b45108859fa03b97088d4>:0 
  at UnityModManagerNet.UnityModManager+ModEntry.Load () [0x00593] in <41afed0fd6f44664b4330828e6d4dd7c>:0 
System.IO.FileNotFoundException: Could not load file or assembly 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null'
System.IO.FileNotFoundException: Could not load file or assembly 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'RuntimeUnityEditor.Core, Version=5.2.1.0, Culture=neutral, PublicKeyToken=null'
[RuntimeUnityEditor] Loading time 0.09 s.
[Manager] FINISH. SUCCESSFUL LOADED 0/1 MODS.

In this instance, moving the Core dll into the game's 'managed folder' resolves the issue. Using ILRepack to merge the two dlls into a single dll also resolves the issue. Both "solutions" feel like hacks/bandaids rather than a real solution.

The same behaviour has been observed on one other mod that uses a multi-dll config.

I don't have any experience with dynamically loading assemblies, but I suspect the issue occurs when the dependencies are resolved, with the resolver looking to the wrong folder.

There might be a better way to fix this, but this StackOverflow answer looks like a starting point.

@newman55
Copy link
Owner

For the net framework, this should be the default behavior of searching in the same directory. It works fine in other games.
I need to dig.

@mricher-git
Copy link

mricher-git commented Feb 7, 2024

Hi @newman55, was just testing this in Railroader. If using Doorstop proxy, it does search the mod directory, but if using the Assembly method, it does not.

Edit: This appears not to be case. I still need to copy the other DLL's to Managed folder when using Doorstop.

@mricher-git
Copy link

@newman55 was trying to look into this to help out but I'm not sure what the issue is. When using same UMM version and mod version, Derail Valley happily opens extra DLL's in mod folder, but Railroader does not. In case you don't own RR, let me know if there's anything I can test on my end. Cheers.

@newman55
Copy link
Owner

Fixed

@t0stiman
Copy link

t0stiman commented Apr 1, 2024

the issue persists

@newman55
Copy link
Owner

newman55 commented Apr 1, 2024

Give me a link to the mod so I can check it out

@mricher-git
Copy link

mricher-git commented Apr 5, 2024

It's Runtime Unity Editor, can't find RuntimeUnityEditor.Core.dll and the associated MonoMod/Mono.Cecil, etc

Need to copy all .dll's except RuntimeUnityEditor.UMM.dll into game's Managed folder to make it run. For me, this is only happening in Railroader game, same UMM/RUE work fine in Derail Valley for example.

@newman55
Copy link
Owner

newman55 commented Apr 5, 2024

With the latest fix, RuntimeUnityEditor in Railroader started working. Are there any other mods/games that don't work? Or is this problem persisting?

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

No branches or pull requests

4 participants