[MSIL] How to replace existing method by MSIL at runtime in CoreClr? #110934
-
Hello all, Harmony package can support this feature, but I no idea to how implement. Ask for your help to tell me which knowledge I need to study, thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Modifying running code is not supported. There is hot patching that can update running code, but it's debug only and has many limitations. Harmony itself doesn't do the patching. It only composes code blocks in to methods, and depends on MonoMod to replace methods. MonoMod's documentation contains some discussion about hooking methods. It requires to update process memory directly. It's generally unsupported, unreliable and can be broken by many factors, including security or anti-malware enhancement, CLR feature update or refactor. |
Beta Was this translation helpful? Give feedback.
Modifying running code is not supported. There is hot patching that can update running code, but it's debug only and has many limitations.
Harmony itself doesn't do the patching. It only composes code blocks in to methods, and depends on MonoMod to replace methods.
MonoMod's documentation contains some discussion about hooking methods. It requires to update process memory directly. It's generally unsupported, unreliable and can be broken by many factors, including security or anti-malware enhancement, CLR feature update or refactor.