Closed Awarets closed 8 months ago
Could it be that the empty methods are optimised away or inlined when you build a release build (I assume that’s what Godot exported build means). Can you try to add some code and maybe some try/catch code that is known to prevent inlining?
A more likely reason is a mismatch of dependency version. Harmony needs and uses some dependencies and I guess one of them does not match the one that is actually loaded and present at runtime.
The problem still occurs even with non-empty methods. (Harmony log and exception stacktrace are identical)
I think I may have identified the mismatched dependency though. Harmony in .NET 6 is dependent on System.Text.Json 5.0.2, but that version of System.Text.Json doesn't appear to be compatible with .NET 6. The version of System.Text.Json in the release build is 6.0.2123.36311 instead.
fixed in next prerelease
Issue is unfortunately still occurring even in the newest prerelease.
The only other lead I have is that Mono.Cecil doesn't seem to support .NET 6.0 (or any base .NET version), however that leaves me confused as to how patching is able to even function within the godot editor itself.
Describe the bug An exception (detailed below) is thrown when attempting to perform a patch in an exported Godot Build.
To Reproduce Use the following code with Harmony 2.3-prerelease.4 in Godot 4.2.1:
Harmony debug log:
Exception StackTrace:
Runtime environment (please complete the following information):
Additional context The exception only appears to be thrown in an exported build. No exception is thrown within the editor, and everything behaves as expected.