BepInEx / Il2CppInterop

A tool interoperate between CoreCLR and Il2Cpp at runtime
GNU Lesser General Public License v3.0
215 stars 67 forks source link

System.AccessViolationException when using MelonLoader for Idle Slayer #138

Open Jamjardavies opened 4 months ago

Jamjardavies commented 4 months ago

When using MelonLoader (latest version) for the Steam version of Idle Slayer on Windows, I get this exception, which the MelonLoader team recommended to post here.

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Il2CppInterop.Runtime.Injection.Hooks.MetadataCache_GetTypeInfoFromTypeDefinitionIndex_Hook.Hook(Int32)
   at Il2CppInterop.Runtime.Injection.Hooks.Class_FromName_Hook.Hook(Il2CppInterop.Runtime.Runtime.Il2CppImage*, IntPtr, IntPtr)
   at Il2CppInterop.Runtime.IL2CPP.il2cpp_class_from_name(IntPtr, System.String, System.String)
   at Il2CppInterop.Runtime.IL2CPP.GetIl2CppClass(System.String, System.String, System.String)
   at Il2CppSystem.Void..cctor()
   at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(System.RuntimeTypeHandle)
   at Il2CppInterop.Runtime.Il2CppClassPointerStore`1[[Il2CppSystem.Void, Il2Cppmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null]]..cctor()
   at Il2CppInterop.Runtime.Injection.ClassInjector.ConvertStaticMethod(VoidCtorDelegate, System.String, Il2CppInterop.Runtime.Runtime.VersionSpecific.Class.INativeClassStruct)
   at Il2CppInterop.Runtime.Injection.ClassInjector.RegisterTypeInIl2Cpp(System.Type, Il2CppInterop.Runtime.Injection.RegisterTypeOptions)
   at Il2CppInterop.Runtime.DelegateSupport.ConvertDelegate[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Delegate)
   at UnityEngine.Events.UnityAction`2[[UnityEngine.SceneManagement.Scene, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[UnityEngine.SceneManagement.LoadSceneMode, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].op_Implicit(System.Action`2<UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.LoadSceneMode>)
   at MelonLoader.Support.SceneHandler.Init()
   at MelonLoader.Support.Main.Initialize(MelonLoader.ISupportModule_From)
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Span`1<System.Object> ByRef, System.Signature, Boolean, Boolean)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Reflection.MethodBase.Invoke(System.Object, System.Object[])
   at MelonLoader.SupportModule.LoadInterface(System.String)
   at MelonLoader.SupportModule.Setup()
   at MelonLoader.Core.Start()
   at MelonLoader.NativeHost.NativeEntryPoint.Start()
ds5678 commented 4 months ago

Are sure that's still relevant? It's been 2 years since an il2cppinterop release

Jamjardavies commented 4 months ago

Not sure but I was directed to here from MelonLoader.

stjoannou commented 2 months ago

Are sure that's still relevant? It's been 2 years since an il2cppinterop release

yes have the same issue currently.

@Jamjardavies refers to https://github.com/LavaGang/MelonLoader/issues/639

Elyriand21 commented 1 month ago

I was having the exact same issue and the fix that worked for me was adding --melonloader.disablestartscreen to the properties on Steam for the game

Jamjardavies commented 1 month ago

It seems the latest version of MelonLoader has fixed this issue for Idle Slayer.