Skip to content

[MSIL] How to replace existing method by MSIL at runtime in CoreClr? #110934

Answered by huoyaoyuan
Li7ye asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Li7ye
Comment options

@huoyaoyuan
Comment options

Answer selected by Li7ye
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants