Fix bugs in .NET program without access to source

那年仲夏 提交于 2019-12-04 03:00:51

If the program is simple, in theory you could use reflector to reverse the entire program back to C#, make the change and recompile it.

Alternatively you could try a tool like ILDasm, which should allow you to extract the IL, make your change (in MSIL), and re assemble (using ILAsm). Obviously to do this you'll have to figure out how to write your change in IL, so you'll probably have to do some experimenting to see how if statements compile.

I suspect both will take quite a bit of messing around to get the recompile to work.

Good luck.

If you get it to work, post back and let me know, I'd be quite interested in how you did this.

I suggest you use the Reflexil plugin for Reflector. It allows you to easily modify assemblies, and even replace the body of a method by your own C# code.

I don't think there is an easier way to do this than what you already mentioned. I actually decompiled a program with ILDASM for something similar and it took quite a lot of tinkering.

If there is an easier method I'd like to know it too.

You can use ILDASM and ILASM to make a roundtrip. While this is impractical for large changes, I think that it should do the trick in your case.

Try this .NET Reflector addin.

This has worked for me. It sometimes creates "Complier Generated" tags which cannot be complied. But you can easily fix this manually.

telerik Just Decompile (free) Then the reflexil plug in

2 min job with the above (I've tried all the other methods!!)

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