I am currently working on a compiler for the language (external bytecode) and am using System.Reflection.Emit.
Now everything looks great when I open the generated assembly in the reflector and it recompiles, since C # works fine (and starts) too, but when I try to run the main function that is generated, I get InvalidProgramException:
"The usual runtime runtime detected an invalid program."
This is probably just one op code causing this problem, but since this main function uses more than 100 op codes, I cannot determine which of the op codes is causing the problem.
Each op code is very involved, so manually each op code is non-go.
Is there a way to get .NET to tell me where in the function it detects an invalid program?
And if not, is there another tool I can use to determine the source of the problem?
source
share