Il2CppInterop icon indicating copy to clipboard operation
Il2CppInterop copied to clipboard

Assembly Resolution Validation

Open TrevTV opened this issue 1 year ago • 1 comments

ds5678 was notified of this on Discord, but I am making an issue as well.

There have been groups of games that seem to be throwing errors when generating assemblies from Pass81, more specifically, the call to UnstripTranslator.TranslateMethod. It seems like some things are not getting parsed correctly/fully leading to System.Collections.Generic.KeyNotFoundException: The given key 'X' was not present in the dictionary. errors occurring.

This was seen on standard Interop through MelonLoader.

Car Mechanic Simulator 2021 on MelonLoader v0.6.5 24-10-24_15-24-37.log

(no full log was provided) Pixel Worlds likely on MelonLoader v0.6.5 or v0.6.4, both use recent versions of Interop image

On my fork of Interop for use with LemonLoader (Android support for ML), I also found a game that did something similar but not exactly the same. Instead of it failing to find a type, it would fail to find the entire Il2Cppmscorlib assembly here, even though it was generated. Note that the generator portion of Interop wasn't changed much by me, I basically only changed how xrefs were done. This log isn't complete but shows the issue happening at the same pass, I was able to confirm that the line I linked was the problem code. Latest.1.log

TrevTV avatar Oct 25 '24 03:10 TrevTV

After many discussions in Discord, we have determined that this is a downstream issue caused by library users not properly setting the assembly resolvers on the assembly definitions they create. When running the CLI, which uses in-house assembly resolvers, the error does not occur.

Il2CppInterop should continue to not modify the assembly definitions provided to it, but it can provide validation against this issue.

ds5678 avatar Dec 22 '24 19:12 ds5678