LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.38k stars 472 forks source link

[Bug]: IL2CPP debugging errors on logging message #719

Closed korbykob closed 1 month ago

korbykob commented 1 month ago

All of the following criteria must be met

All of the following are optional to answer

Describe the issue.

When starting a debugger and logging it, it errors out, after I modified the dll to not call the log it worked perfectly. No log file is produced but there is a log:

[06:06:38.867] [DEBUG] Attaching hook to il2cpp_init
[06:06:39.067] [DEBUG] Detaching hook from il2cpp_init
[06:06:39.279] [DEBUG] [Dotnet] Invoking LoadStage1
[NewEntryPoint] Passing ptr to LoadAssemblyAndGetFuncPtr back to host...
[06:06:39.285] [DEBUG] [Dotnet] Reloading NativeHost into correct load context and getting LoadStage2 pointer
[06:06:39.287] [DEBUG] [Dotnet] Invoking LoadStage2
[NewEntryPoint] Configuring imports...
[NewEntryPoint] Initializing. In default load context: True
[NewEntryPoint] Caught exception invoking Initialize! System.NullReferenceException: Object reference not set to an instance of an object.
   at MelonLoader.Utils.MelonConsole.WriteLine(String txt) in D:\a\MelonLoader\MelonLoader\MelonLoader\Utils\MelonConsole.cs:line 46
   at MelonLoader.MelonLogger.Internal_Msg(Color namesection_color, Color txt_color, String namesection, String txt) in D:\a\MelonLoader\MelonLoader\MelonLoader\Utils\MelonLogger.cs:line 285
   at MelonLoader.MelonLogger.NativeMsg(Color namesection_color, Color txt_color, String namesection, String txt, Boolean skipStackWalk) in D:\a\MelonLoader\MelonLoader\MelonLoader\Utils\MelonLogger.cs:line 153
   at MelonLoader.MelonLogger.Msg(String txt) in D:\a\MelonLoader\MelonLoader\MelonLoader\Utils\MelonLogger.cs:line 113
   at MelonLoader.Core.Initialize() in D:\a\MelonLoader\MelonLoader\MelonLoader\Core.cs:line 44
   at MelonLoader.NativeHost.MelonLoaderInvoker.Initialize() in D:\a\MelonLoader\MelonLoader\MelonLoader.NativeHost\MelonLoaderInvoker.cs:line 10
   at MelonLoader.NativeHost.NativeEntryPoint.Initialize() in D:\a\MelonLoader\MelonLoader\MelonLoader.NativeHost\NativeEntryPoint.cs:line 43

Did you attach your log file?

No, I could not find a log file at {Game_Directory}\MelonLoader\Latest.log