Skip to content

Releases: pardeike/Harmony

Harmony 2.3-prerelease.3

11 Jun 19:18
Compare
Choose a tag to compare
Pre-release

Fixes

  • fixes a bug where Harmony calls TargetMethods() always twice [7ab508c]

Additions

  • adds Mono.Cecil.ByReferenceType, Mono.Cecil.GenericInstanceMethod, Mono.Cecil.GenericInstanceType, Mono.Cecil.TypeSpecification and Mono.Cecil.Cil.OpCodes to ForwardingAttributes

For the main description see v2.3-prerelease.2

Harmony 2.3-prerelease.2

01 Jun 08:50
dd34cfe
Compare
Choose a tag to compare
Pre-release

Harmony 2.3 now uses MonoMod.Core which is a rewrite of the low level backend for patching .net methods. We have been preparing and testing this for months but since so much has changed behind the scenes, the community need to step up and actively test if this release breaks things.

On the plus side, we now have .NET 7 support (yay!) and hopefully a bunch of bug fixes.

Harmony v2.3 also no longer merges Mono.Cecil into 0harmony.dll which means you probably need to supply it as a dependency yourself if you need it. The advantage on the other hand is that users who already use Cecil don't have any conflicts anymore.

New

What's Changed

New Contributors

Full Changelog: v2.2.2.0...v2.3-prerelease.2

Harmony 2.2.2

19 Jul 22:17
Compare
Choose a tag to compare

Version 2.2.2 includes:

  • #462 does no longer throw if Environment.SpecialFolder.Desktop does not exist (on Linux for example)
  • #465 Fix Unpatch default parameter
  • 6006140 fixes __runOriginal logic (in Postfix it did return false even though original ran)
  • #487 adds linux support for struct return buffer checks

and adds:

  • set FileLog.StreamWriter to switch logging to your own stream
  • set HARMONY_NO_LOG to skip all normal logging
  • #472 to allow passing methods directly to SymbolExtensions (lang 10 feature)
  • adds LoadsConstant(this CodeInstruction code, string str)
  • adds CodeMatch(() => Method)

Harmony 2.2.1

12 Mar 22:06
Compare
Choose a tag to compare

Harmony v2.2.1 brings you/fixes:

  • random patching exception #444
  • unable to patch methods which DeclaringType is null #445
  • update patching-edgecases.md #379
  • sequencializes Azure tests to combat random failures
  • adds MethodType.Enumerator, AccessTools.EnumeratorMoveNext and FileLog.Debug
  • adds back a first draft of the CodeMatcher with improvements
  • can't get instructions of HttpRuntime.ReleaseResourcesAndUnloadAppDomain #449
  • support method body decoding for methods with jump instructions #449 #450
  • adds GetOriginalMethodFromStackframe, fixes wording in CodeInstruction.MoveXXTo/From
  • don't emit stloc ldloc resultVariable in methods ending in throws
  • don't JIT-compile generic methods in FindReplacement
  • refactors AccessTools, adds typeColonName everywhere possible
  • small documentation fixes
  • update to MonoMod.Common 22.3.5.1
  • adds HarmonyPatch(string typeName, string methodName, MethodType methodType)

ENJOY

Harmony 2.2

25 Jul 12:09
Compare
Choose a tag to compare

Added:

  • adds FieldRef<in T, F> 036ad27
  • support for JsonSerialization where BinaryFormatter is not supported 54ae947
  • reapply patches to re-jit methods #428
  • allow TargetMethod(s) with ReversePatch #432
  • add object[] __args support #25

Fixed:

  • improves memory corruption protection (primarily *nix users) 70e388f
  • reflection cache updates 3c4cd7f
  • GetOriginal() #412
  • Upgrade Microsoft.NETFramework.ReferenceAssemblies version #419
  • fixes HarmonyPatchAll attribute handling 9e03ed3

Updated:

  • update to MonoMod.Common 21.12.27.1 80c92f5
  • more modern Harmony logo

ENJOY

Harmony 2.1

05 Jul 01:08
Compare
Choose a tag to compare

Fixes:

  • FieldRef now supports F = underlying integral type for enum field types #361
  • AccessTools.CreateInstance can now use non-public parameterless constructors #362
  • Adds missing internal label in debug output 70d4652
  • Supports all argument mapping #371
  • Prevent recursive assembly scan from AccessTools static initializer #385
  • Uses ReaderWriterLockSlim with ReaderWriterLock under NET 3.5 #364
  • Makes __state being keyed more unique so same class names do not colide #408

Added:

  • Adds support, testing and CI for .NET 5
  • Adds bool flag injection to prefixes to find out if original will be skipped #392
  • Adds documentation to PatchAll to warn about inlining choosing the wrong assembly #395

New API in AccessTools:

  • Adds AccessTools.CreateInstance<T>() #362

Misc:

  • Update MonoMod.Common to 21.6.21.1
  • Adds pointer sizes to debug log header #388
  • Improve performance and stability of shared state
  • Wording in error message

Harmony 2.0.4

31 Oct 10:09
Compare
Choose a tag to compare

Harmony 2.0.4 reverts a change in 2.0.3 that broke ABI compatibility

Fixes:

  • Improve AccessTools.*FieldRefAccess safety by handling edge cases and having consistent error handling [9a3da4b]
  • Fix AccessTools.FindIncludingBaseTypes NRE on interface types [684b9b7]
  • Add EditorBrowsableState.Never to the specific AccessTools.IsStatic methods [9be1fb0]
  • Reduce array copies in patch tracking [7991c14]
  • Make sure the Harmony logging directory exists [69ef98e]
  • Fix CTD in Linux when patching short methods (typically empty virtual methods) [406586a]
  • Improve Harmony thread safety [f13beaf][1305a1f]
  • Add handler cache for AccessTools.MakeDeepCopy [2f5c171]
  • Add HARMONY_LOG_FILE environment variable [318c1d2]
  • Remove unconditional call to FileLog [42d8567]

Added:

  • More environment info at start of harmony log [bf3286d]
  • Support patching methods with ref result [439b004]

New API in AccessTools:

  • delegate ref F StructFieldRef<T, F>(ref T instance)
  • StructFieldRef<T, F> StructFieldRefAccess<T, F>(string fieldName)
  • StructFieldRef<T, F> StructFieldRefAccess<T, F>(FieldInfo fieldInfo)
  • ref F StructFieldRefAccess<T, F>(ref T instance, string fieldName)
  • ref F StructFieldRefAccess<T, F>(ref T instance, FieldInfo fieldInfo)

Misc:

  • Stop using Travis and AppVeyor and move all testing to Azure Pipelines
  • Migrate from ILRepack.Lib.MSBuild.Task to ILRepack.Lib.MSBuild [36d8cbc]
  • Project now supports C# 8
  • Various code and csproj cleanup

Harmony 2.0.2

28 Jul 18:45
Compare
Choose a tag to compare

Fixes:

  • MonoMod.Common updated to v20.5.31.1
  • Method serialization now uses module guid instead of name [ca5fd9b]
  • AccessTools.Method(string typeColonMethodname, ...) uses "Namespace.Type:MethodName" as format
  • Include type in patched method names for stack traces [1bdd4b4]
  • Traverse now handles chaining static then non-static member calls correctly [2b6ad84]
  • FastInvokeHandler now uses params for varargs [c9934e1]
  • PatchTools.GetPatchMethods now returns every method, not just the ones to be patched #304 [31b4773]
  • GetOriginalInstructions/GetCurrentInstructions now populate code.labels correctly
  • Fix exception in Harmony.PatchAll/AccessTools.TypeByName when assembly dependencies are missing [a0c3620] [424c2ce]
  • Preparatory work for: delegate injection, AccessTools.FieldRef improvements (work in progress, more in next release)

New API for CodeInstruction:

  • codeInstruction.WithLabels(params Label[] labels)
  • codeInstruction.WithLabels(IEnumerable<Label> labels)
  • codeInstruction.ExtractLabels(this CodeInstruction code)
  • codeInstruction.MoveLabelsTo(CodeInstruction other)
  • codeInstruction.MoveLabelsFrom(CodeInstruction other)
  • codeInstruction.WithBlocks(params ExceptionBlock[] blocks)
  • codeInstruction.WithBlocks(IEnumerable<ExceptionBlock> blocks)
  • codeInstruction.ExtractBlocks(this CodeInstruction code)
  • codeInstruction.MoveBlocksTo(CodeInstruction other)
  • codeInstruction.MoveBlocksFrom(CodeInstruction other)

New API in PatchProcessor:

  • PatchProcessor.CreateILGenerator(MethodBase original)

New API in AccessTools:

  • AccessTools.MethodDelegate<DelegateType>(MethodInfo method, object instance = null, bool virtualCall = true)
  • AccessTools.HarmonyDelegate<DelegateType>(object instance = null)
  • AccessTools.IsStatic(MemberInfo member)

Harmony 2.0.1

10 May 09:13
Compare
Choose a tag to compare

Fixes:

  • MonoMod.Common updated to v20.5.7.1
  • Unpatch has improved documentation pointing out it being global

New API:

Existing API:

  • Transpilers can default to original input by returning null

Harmony 2

20 Apr 20:13
Compare
Choose a tag to compare

2.0.0.10 fixes #275 and updates MonoMod.Common to 20.4.20.1

It also adds

  • HasMethodBody
  • CreateILGenerator
  • more variation for AccessTools.FieldRef/StaticFieldRef