pardeike / Harmony

A library for patching, replacing and decorating .NET and Mono methods during runtime
https://www.patreon.com/pardeike
MIT License
5.15k stars 485 forks source link

can lib work in arm64? #602

Closed moonfanslyj closed 5 months ago

moonfanslyj commented 5 months ago

I tried executing the patch method in an aspnetcore app and publishing it to docker on an arm64 machine

bug docker cannot run my app

  1. The original method : protected ReportPage GetOverlayPage(ReportPage page) { if (page != null) { OverlayBand overlayBand = new OverlayBand(); overlayBand.Parent = page; overlayBand.Bounds = new RectangleF(0f, (0f - page.TopMargin) Units.Millimeters, 200f, 20f); new TextObject { Parent = overlayBand, Bounds = new RectangleF(0f, 0f, Units.Millimeters 50f, 20f), Text = typeof(double).Name[0].ToString() + typeof(Exception).Name[0] + typeof(Math).Name[0] + typeof(object).Name[0] + " " + typeof(ValueType).Name[0] + typeof(Exception).Name[0] + typeof(Rectangle).Name[0] + typeof(ShapeKind).Name[0] + typeof(ICloneable).Name[0] + typeof(object).Name[0] + typeof(NonSerializedAttribute).Name[0] }; }

    return page;

    }

  2. The patch code: var harmony = new Harmony("test"); var m1 = AccessTools.Method(typeof(xxxxclassname), "GetOverlayPage"); var mPrefix1 = SymbolExtensions.GetMethodInfo(() => DoNotExecute()); if (m1 != null) harmony.Patch(m1, new HarmonyMethod(mPrefix1));
  3. The output of the Harmony debug log: 2024-03-27 17:54:27 2024-03-27 17:54:27.6223|ERROR|Service Aquarium.Mermaid.Service Stopped program because of exception 2024-03-27 17:54:28 Unhandled exception. System.NotImplementedException: The method or operation is not implemented. 2024-03-27 17:54:28 at HarmonyLib.PatchFunctions.UpdateWrapper(MethodBase original, PatchInfo patchInfo) 2024-03-27 17:54:28 at HarmonyLib.PatchProcessor.Patch() 2024-03-27 17:54:28 at HarmonyLib.Harmony.Patch(MethodBase original, HarmonyMethod prefix, HarmonyMethod postfix, HarmonyMethod transpiler, HarmonyMethod finalizer)

Runtime environment (please complete the following information):

pardeike commented 5 months ago

Harmony uses MonoMod.Core for low level functions. So you better post that there. I know they already have an Issue on arm architecture.

moonfanslyj commented 5 months ago

Harmony uses MonoMod.Core for low level functions. So you better post that there. I know they already have an Issue on arm architecture.

ok thks