I have a program i frequently use that is made with .NET. This program has a small bug that is very annoying and the developer to the app is nowhere to be found.
I have found the location of the problem in reflector and just want to add a single if-statement here and then recompile the program.
What is the easiest way to do this?
I have tried using the export-function in reflector but it doesn't seem to work perfectly. For example alot of using-directives are missing and enums that are cast back and forth to ints are also not exported properly. I believe i can fix this with some work but i'm wondering if there are any easier way to do this.
Update: Solved it by doing this:
The program is a single file executable
Done! I've only used the fixed program some minutes right now but it seems to work just like before except for the bug :)
I also ran into some problems with the application settings. In %appdata%\ProgramName there was a folder called something like ProgramName.exe_Url_qa5i3p42aomuvoxpuxuficvbmngksgjs where all settings are stored. My new executable created a new folder like this with different random letters at the end and with the default settings. To copy the settings you used before just copy all the contents of the old folder to the new one.
Definition: Debugging is the process of detecting and removing of existing and potential errors (also called as 'bugs') in a software code that can cause it to behave unexpectedly or crash. To prevent incorrect operation of a software or system, debugging is used to find and resolve bugs or defects.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With