sinai-dev / UniverseLib

A library for making plugins which target IL2CPP and Mono Unity games.
GNU Lesser General Public License v2.1
119 stars 51 forks source link

Use Assembly.LoadFrom to ensure interop assemblies are loaded #9

Open Kasuromi opened 2 years ago

Kasuromi commented 2 years ago

Context

Assembly.LoadFile will load the assembly in a new AssemblyLoadContext, which causes unexpected behavior on Il2CppInterop (& Unhollower)

A similar issue was recently resolved on BepInEx

Relevant issues

sinai-dev/UnityExplorer#158

it is finding two types called Il2CppSystem.Byte in Il2Cppmscorlib

Due to UniverseLib accidentally loading a second Il2Cppmscorlib into the runtime, Il2CppInterop fails on the Single call due to there being more than one assembly.

grimkor commented 1 year ago

Hey just want to chime in and say this fixed an issue I was having with BepInEx IL2CPP plugin I was working on. Compiled the forked version @Kasuromi made and worked like a charm.

Is there any possibility of merging this fix for other users who might not find this alternate solution?