Can Mono.Cecil modify code already loaded in the AppDomain?

廉价感情. 提交于 2019-11-30 18:51:40

Nope, Cecil can not modify a loaded assembly. You have to instrument assemblies before they are actually loaded.

You don't have much control over how assemblies are resolved. You can hook into AppDomain.AssemblyResolve if you hide the assemblies in a private folder of yours, and instrument then before loading them.

As JB Says above- You can create a Resolve Event handler - which would be like PSeudoHooking. And before the assembly is loaded, you make your changes, and then once the changes are done, the Resolve Assembly then continues on to load the changed assembly.

I use this method for resolving Embedded Dll's from Memory Streams.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!