Hi,

I have recently started using the cecil library and have found a
recurring issue in my attempts to inject type from one assembly to
another.Quite interestingly it happens with the stloc.s and ldloc.s
Opcodes as I presume. I have compared the IL from the actual source
Type and the manipulated Type and found these differences.

I am pasting a small part of the IL code below
-------------------------------------------
>From the Actual Method IL :
-----------------------------------------
        finally {
                        IL_0360: ldloc.2
                        IL_0361: ldnull
                        IL_0362: ceq
                        IL_0364: stloc.s 19
                        IL_0366: ldloc.s 19
                        IL_0368: brtrue.s IL_0371
                        IL_036a: ldloc.2
                        IL_036b: callvirt instance void
[mscorlib]System.IDisposable::Dispose()
                        IL_0370: nop
                        IL_0371: endfinally
                } // end handler

------------------------------------------
Injected IL :
--------------------------------------
        finally {
                IL_0376: ldloc.1
                IL_0377: ldnull
                IL_0378: ceq
                IL_037a: stloc.s
                IL_037c: ldloc.s
                IL_037e: brtrue.s IL_0387
                IL_0380: ldloc.1
                IL_0381: callvirt instance void
[mscorlib]System.IDisposable::Dispose()
                IL_0386: nop
                IL_0387: endfinally
        } // end handler

What am I doing wrong?

-- 
--
mono-cecil

Reply via email to