Paul wrote:
Okay, now the program decompiles properly (the IL changes the way I
want it to), but it still doesn't run correctly. I'm receiving an
InvalidProgramException at runtime as soon as the JIT compiler hits
one of the modified instructions. "JIT Compiler encountered an
internal limitation." Could this have more to do with how I'm
importing the type?
From my work on IL-Repack, I learnt that cecil lets you do very much in
such cases which can produce invalid assemblies. Also, most decompilers
are not as pedantic as they should be to show up such errors. I ended up
with running PEVerify and comparing the token numbers which were
reported in PEVerify's errors with tokens reported by Microsoft's Ildasm
(outputting the IL + tokens to a text file for easy searching).
This often showed up that although the decompiler showed the correct
type, cecil mixed up tokens while writing the changed assembly to disc.
Simon
--
--
mono-cecil