-
Notifications
You must be signed in to change notification settings - Fork 44
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
Assembly.GetExecutingAssembly causing game to crash #112
Comments
Does it work fine when loaded by BepInEx? |
Yep seemed to work all fine with with I created this basic plugin
using System.Reflection;
using BepInEx;
namespace BepInEx_Crash_Test
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
// Plugin startup logic
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
var assembly = Assembly.GetExecutingAssembly();
Logger.LogInfo($"This is after calling {nameof(Assembly.GetExecutingAssembly)}, the result was {assembly}");
}
}
} and it showed up all fine in the logs without crashing the game
|
Yes, it is. This means you're missing something in your launcher then. |
If you use HarmonyX v2.12.0, that's most likely the same issue #79 (comment) which was introduced in reorg. I don't think BepInEx is using the reorg version currently? That was supposed to be fixed with 6e3726f which isn't released yet though. Using the latest version of HarmonyX produced the same behavior as you when I was using it in our mod loader. Sometimes it was crashing Unity, sometimes it threw a null ref. You either should use v2.10.2 or wait for the next release. v2.12.0 is broken. And it was released knowing it was broken. For some reason. |
It is not using it yet. This might be fixed by #114 ? |
It should be fixed by #97. |
Added HarmonyX source to my project and compiled at the current latest on master. Ran it three times and it didn't crash! Closing this as I've confirmed its fixed for me. Thank you so much @Meivyn for that insight |
I have been trying to move from Harmony2 to HarmonyX for my mod loader but sadly been hitting a lot of crashes.
Been trying to create a simple mod to load Unity Explorer, in my Awake method I have this:
Putting a break point on
Assembly executingAssembly = Assembly.GetExecutingAssembly();
its all fine, then stepping over this line it crashes withAccess violation
.Does anyone know what could be causing this?
Context
Built Game: VTOL VR
Unity Engine: 2020.3.30f1
Mono
Call stack in the player.logs when it crashes
And
HarmonyFileLog.log
is emptyThe text was updated successfully, but these errors were encountered: