Im trying to remove the subscription to the Tick event in IL Code so that it wont ever fire.
Here is the IL Code:
IL_0e19: ldftn instance void App.Framework.MainForm::mTimer_Tick(object, class [mscorlib]System.EventArgs)
IL_0e1f: newobj instance void [mscorlib]System.EventHandler::.ctor(object, native int)
IL_0e24: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Timer::add_Tick(class [mscorlib]System.EventHandler)
IL_0e29: ldarg.0
So i was thinking i should just be able to remove the last 2 lines to remove the subscription and it should be fine.
IL_0e24: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Timer::add_Tick(class [mscorlib]System.EventHandler)
IL_0e29: ldarg.0
I compile the IL code successfully with:
ilasm.exe c:\Framework.il /32bitpreferred /dll
Now when i try and launch the program it throws the exception:
System.InvalidProgramException: JIT Compiler encountered an internal limitation.
If i compile the IL without any modifications then the program runs without any exceptions, so its the changes im making.