Is there any way to instrument System.Reflection.Emit?
I'm having some serious trouble with a compiler that does its code generation with the classes found in System.Reflection.Emit . It takes code that should be perfectly valid, and that passes all the compiler's internal checks, and tries to codegen it, but TypeBuilder.CreateType() throws the following completely unhelpful exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) The problem lies somewhere in the way it's transforming generators into state machines in a specific edge case, but if I take the