Can anyone give me any pointers on how to debug a 3rd party DLL (no source). I am looking at the DLL in reflector and know exactly where the problem lies, I just need to add one line of code.
Is this difficult ? Do I need to modify IL code ?.
failing that is the method overridable, if so you can inherit the class, then copy the code from reflector adding in your fix though that is prone to issues after an upgrade)
failing that you can copy the entire class's source and use that or get a reflector addin that dumps an assembly to source code.
its probably possible using something like Cecil to rewrite the IL but ive never done that (where as i have done all of the other options on various classes/assemblies)
trendy covered most of it. by far easiest is to get 3rd party to fix, but otherwise see if you can inherit and override the method.
one issue if you can override it, is you will need to call any private/friend methods/fields via reflector in your inherited method call.
also think about whether you can modify some field of the object that will cause whatever code you're after to be executed (it all depends on what the 1 line of code you need to add is going to do)
Yep, normally I would have inherited and overwritten (or shadow) a broken function, but in this case, it was the entire application that was broken, I simply wanted to edit the DLL. Doesn't matter now, I work-around has been found to make the app work, however it would have been an interesting learning exercise.
You can try dumping all the code from reflector and recompiling it with a change. Or, a more low level way...
Use ildasm (disassembler, it comes with the .net sdk/VS), it will dump the assembly to MSIL/CIL (basically the .net 'assembly language').
Make your change (it will be harder than editing source, and you should have some familiarity with low level languages if you are doing more than a few lines changes). Either way, you might find it interesting to learn.