Comments (8)
It should be fixed by #97.
from harmonyx.
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.
from harmonyx.
Does it work fine when loaded by BepInEx?
from harmonyx.
Yep seemed to work all fine with with BepInEx_win_x64_5.4.23.1
. (I assume HarmonyX is packaged up with it by default)
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
[Message: BepInEx] BepInEx 5.4.23.1 - VTOLVR (22/05/2024 21:44:57)
[Info : BepInEx] Running under Unity v2020.3.30.2077119
[Info : BepInEx] CLR runtime version: 4.0.30319.42000
[Info : BepInEx] Supports SRE: True
[Info : BepInEx] System platform: Bits64, Windows
[Message: BepInEx] Preloader started
[Info : BepInEx] Loaded 1 patcher method from [BepInEx.Preloader 5.4.23.1]
[Info : BepInEx] 1 patcher plugin loaded
[Info : BepInEx] Patching [UnityEngine.CoreModule] with [BepInEx.Chainloader]
[Message: BepInEx] Preloader finished
[Message: BepInEx] Chainloader ready
[Message: BepInEx] Chainloader started
[Info : BepInEx] 1 plugin to load
[Info : BepInEx] Loading [BepInEx_Crash_Test 1.0.0]
[Info :BepInEx_Crash_Test] Plugin BepInEx_Crash_Test is loaded!
[Info :BepInEx_Crash_Test] This is after calling GetExecutingAssembly, the result was BepInEx_Crash_Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[Message: BepInEx] Chainloader startup complete
from harmonyx.
I assume HarmonyX is packaged up with it by default
Yes, it is. This means you're missing something in your launcher then.
from harmonyx.
When you say something, are you meaning maybe an assembly? Comparing with dependencies HarmonyX brings in through Nuget vs what I have installed, there isn't anything missing.
Adding this just for context of the thread, now weirdly having:
var path = Assembly.GetExecutingAssembly();
Debug.Log(path);
Throw a null error in debug.log, even though decompiled dll shows its got a null check
NullReferenceException: Object reference not set to an instance of an object
at UnityEngine.Logger.GetString (System.Object message) [0x00032] in <72b60a3dd8cd4f12a155b761a1af9144>:0
at UnityEngine.Logger.Log (UnityEngine.LogType logType, System.Object message) [0x00012] in <72b60a3dd8cd4f12a155b761a1af9144>:0
at UnityEngine.Debug.Log (System.Object message) [0x00006] in <72b60a3dd8cd4f12a155b761a1af9144>:0
at Pop.HelmetPop+<LoadAudioClip>d__2.MoveNext () [0x00030] in <62d0a4dbf2a34d38ba2e27292f55322c>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <72b60a3dd8cd4f12a155b761a1af9144>:0
from harmonyx.
I don't think BepInEx is using the reorg version currently?
It is not using it yet. This might be fixed by #114 ?
from harmonyx.
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
from harmonyx.
Related Issues (20)
- [Wiki] Typos in section 1.4 HOT 1
- [Wiki] Error using the provided postfix in section 1.4 HOT 1
- When will v2.11.0 be published on NuGet? HOT 2
- Android IL2CPP Support HOT 2
- v2.11.0: patch with "ref string" on "static external" method produces garbage HOT 5
- Harmony doesn't work when path contains non-ANSI characters HOT 1
- How do I call a private function within a postpatch HOT 8
- How do I find the asset directory of stuff stored in a unity game? HOT 1
- Reverse patches appears to be broken
- System.Reflection.Emit.ILGeneration is not supported on this platform when using Transpilers. HOT 5
- HarmonyX 2.13 in 7dtd: Interface Default Implementations failing to patch with odd error.
- Empty Transpiler Causing Issues HOT 1
- How to override explicit interface methods? HOT 1
- When did it start to support net 7 or 8? HOT 1
- Cannot unpatch extern method patch
- Patching ref parameter with IL2Cpp results in invalid IL
- Usage with unity
- Empty Harmony Annotations Cause ArguementException: No Target Method Found HOT 2
- Skipping a patch when a method isnt found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harmonyx.