Releases: pardeike/Harmony
Harmony 2.4.1
Harmony v2.4.1 mainly fixes that v2.4 leaked types of Mono.Cecil.* to the public API.
What's Changed
- Internalize dependencies in merged packages by @pardeike in #706
- Fix a bunch of Mono.Cecil's API being public in the merged version by @Banane9 in #708
- Fix Process resource leak, CI warnings, and improve .NET version consistency by @Copilot in #709
- Fix TRX file XML parsing errors in Platform Tests by sanitizing test output by @Copilot in #710
- Remove redundant Harmony zip artifacts from Platform Tests workflow by @Copilot in #711
Full Changelog: v2.4.0.0...v2.4.1.0
Harmony 2.4
Harmony 2.4 includes a lot of bug fixes and now supports arm64!
Enjoy and consider supporting me on Patreon or become a GitHub sponsor!
Changelog
Added
-
Full support for arm64 across all operating systems, including Apple Silicon
-
Configurable error handler: A new API lets you register a global error handler that Harmony invokes whenever a patch throws an exception. This allows logging or suppressing errors centrally
-
Extended CodeMatcher API: New methods—RemoveSearchForward, RemoveSearchBackward, RemoveUntilForward, RemoveUntilBackward and Do—make it easier to remove or transform instruction sequences via CodeMatcher
-
Struct patching: [HarmonyPatch] attributes can now target methods defined in structs, not just classes
-
Additional MethodType cases: Harmony’s API now covers more method kinds (e.g., async methods, property accessors or operators). This broadens the range of targets you can patch
-
Simpler manual patch registration: The PatchClassProcessor no longer requires Harmony‑specific attributes when registering patches programmatically
Changed
-
Patch serialization: PatchInfo now uses ToArray() instead of MemoryStream.GetBuffer to serialize patches, improving compatibility across .NET runtimes
-
JSON serialization improvements: InnerMethod and patch classes gained custom System.Text.Json converters. Patch information now serializes round‑trip correctly and fields such as infixes were replaced with innerprefixes and innerpostfixes (new infix system)
-
Exception handling: try/fault blocks emitted by Harmony are now compiled as try/catch/finally and won't fail to patch anymore
Fixed
-
Correct index for local variables: CodeInstructionExtensions.LocalIndex now checks whether an operand is a LocalBuilder; it returns the correct LocalIndex instead of converting to int, preventing mis‑indexed local variables in transpilers
-
Infix negative position bug: Matching of negative positions in infix patches was corrected; positions counting from the end now compute the index properly
-
Argument validation for InnerMethod: Creating an InnerMethod now throws ArgumentNullException if method is null and ArgumentException if any position is zero, preventing silent errors
-
Stream memory handling: A bug where patch generation incorrectly used MemoryStream.GetBuffer (which could include unused capacity) was fixed; ToArray is now used instead
-
IL offset logging: IL offsets are logged again and reported accurately when debugging patched methods (commit referenced in release tag).
Removed
- HarmonyException serialization: HarmonyException is no longer marked [Serializable], so it can no longer be marshalled across AppDomains or remoted contexts
New Contributors
Full Changelog: v2.3.6.0...v2.4.0.0
Harmony 2.3.6
Oops in v2.3.5
- #633 fixes a binary compatibility issue present in 2.3.5 so if you have problems with 2.3.5 this release will fix them. Sorry for the inconvenience!
What's Changed
MethodDelegate
now allows for swapping value type with object, and allow ref for arg 0 on value type #633- Add
CodeMatcher.InsertAfter
and improve exception handling 919f138 - Use the proper instruction for
TypeCode.DateTime
andTypeCode.Decimal
7e18ac1 - Remove leftover debugger log #653
- Allow
OpCodes.Ldstr
inLoadsConstant
#656 - Fix bug in handling
__args
argument with out bool parameters #657 #659 #660 - Add Test Case for #657 #658
- Improve performance of
AccessTools.TypeByName()
a390e14 - Add
AccessTools.TypeSearch()
a390e14
New Contributors
- @samuelmasse made their first contribution in #653
- @SoundOfScooting made their first contribution in #656
- @xADDBx made their first contribution in #657
Harmony 2.3.5
Fixes a regression/oversight in 2.3.4 that makes System.Text.Json 9.0.1 a dependency on all .NET versions
Harmony 2.3.4
What's New
- supports .NET 9
- API landing page in the docs
What's Changed
- updates to MonoMod.Core v1.2.3
- updated version of ILRepack
- updated readme with more game references
- fixes Codes shortcuts, applies HarmonyArgument before special name lookup e8b4857
- documentation fixes (incl. a CodeMatcher example by @warquys)
- bumped dependency versions
- handle using object in place of value type, and vice versa e04f564
- fixe NRE #639
- allows empty string for targeting special MethodType options and doesn't try searching for it with AccessTools 0b13d7b
- adds a test for #640
- net9 locking in FileLog 57ed506
- handle constant/static readonly fields in MakeDeepCopy #619
- fixed wrong cache call in CallClosure() 22959ce
- prevents infinite loop in CodeMatcher when using MatchStartBackwards/Repeat #647
Known unsolved issues
- methods returning
bool?
cannot be patched correctly (disabled test 81aa26a)
Harmony 2.3.3
Harmony 2.3.2
Harmony 2.3.1.1
This releases fixes a regression for .Net Standard projects
Harmony 2.3.1
v2.3.1 fixes:
- Dependency problem / duplicate type errors that we introduced with v2.3
- Better dead code handling #584
- new Lib.Harmony.Ref for projects targeting .NET Standard 2.0
Harmony Thin 2.3.0.1
This update updates Harmony Thin only and makes the dependency on MonoMod.Core public so it is included in transitive dependencies. No other changes.