Replies: 8 comments 8 replies
-
@pardeike I wanted to let you know that Harmony is really freaking amazing! I just found this library today and I love it! |
Beta Was this translation helpful? Give feedback.
-
Hi @pardeike - I wanted to give you some of my thoughts about how Harmony3 could be even better: Today, it seems like there is a lot of nuance around what the method signatures should be when overriding methods. I would like to suggest that this be standardized and well-documented. I would recommend following a programming model similar to what PostSharp or MetaLama do when calling into base methods. For example, when creating an override, I feel like I should be able to do something like the following: Overriding an Instance Method
Overriding a Static Method
Overriding a Generic Method
In the above, there are a few things that I'd like to point out:
By convention, all classes that inherit from
|
Beta Was this translation helpful? Give feedback.
-
Hi @pardeike -
|
Beta Was this translation helpful? Give feedback.
-
It would also be great if Harmony had some prebuilt
|
Beta Was this translation helpful? Give feedback.
-
Hi Andreas, I tried to apply Harmony to the following problem: I want to set all CommandTimeout for all SqlCommand's to 0 (the idea is to be able to have lunch while sitting on a breakpoint in debug mode without timed-out commands in other threads). Turns out, all is well for .NET48 I have to use in 64-bit build, with just one fix: Here's why: SqlCommand has several ctors, and poor GetMethod gets confused and throws; on the other hand, I cannot put Type.EmptyTypes in [HarmonyLib.HarmonyPatch(typeof(SqlCommand), HarmonyLib.MethodType.Constructor)] attribute b/c Type.EmptyTypes is NOT a const. Maybe things are more relaxed in .NET 6, but this trick works in all cases. However, in 32 bit case I get an infinite loop in protected override unsafe IntPtr GetFunctionPointer(MethodBase method, RuntimeMethodHandle handle) in ...\MonoMod.Common\RuntimeDetour\Platforms\Runtime\DetourRuntimeNETPlatform.cs@106-@260 - the code returns to ReloadFuncPtr: label infinitely. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure about the complexity of prefixes, postfixes, and patches.
|
Beta Was this translation helpful? Give feedback.
-
@pardeike hi, hope this is an ok place to ask this: On an issue comment you mention you're doing some work to make Harmony use MonoMod. Now there's also the HarmonyX repo which seems to do the same. So I guess I just wonder if MonoMod is on the horizon for your original repo. (For context: I'm mainly interested in the ability to patch Unity's |
Beta Was this translation helpful? Give feedback.
-
Harmony uses MonoMod.Core under the hood |
Beta Was this translation helpful? Give feedback.
-
👋 Welcome!
This Discussions page acts as a place to define what Harmony 3 will look like. We hope that you:
To get started, comment below with an introduction of yourself and tell us your thoughts and ideas for the future of Harmony.
Beta Was this translation helpful? Give feedback.
All reactions