|
I've been given some code and permission to do with it as I like, but everything is done using the ILGenerator class - Reflection - and I don't understand any of it. There are many hundred lines like the example below.
And for anybody who doesn't know the answer but knows some .NET, IL = Intermediate Language, aka MSIL. When you compile a .NET assembly it's turned into IL, which is somewhat like portable assembly language. The JIT (Just In Time) compiler then translates this at runtime into instructions optimized for the local machine, taking into account CPU type and number, and things like that.
I can see it's loading three arguments and then calling a method, and setting a breakpoint this happens so often I just can't pull meaningful info by debugging it. Is there any way I can take this in memory only assembly that gets generated, and decompile it from memory to see what's really going on?
ilGen.Emit(OpCodes.Ldarg_0);
ilGen.Emit(OpCodes.Ldarg_1);
ilGen.Emit(OpCodes.Ldarg_2);
ilGen.Emit(OpCodes.Call,
typeof(InsaneGeneratedClass).GetMethod("DispatchEv ent",
BindingFlags.Instance | BindingFlags.NonPublic));
ilGen.Emit(OpCodes.Ret);
|