Hi JB ,
I add the variables from the sourceMethod to the targetMethod as
int varIndex = 0;
foreach (var varDef in method.Body.Variables)
{
targetMethod .Body.Variables.Add(new
VariableDefinition(targetAssembly.Modules[0].Import(sourceMethod
.Body.Variables[varIndex].VariableType)));
varIndex += 1;
}
and I add the Instruction (looping through the source method
instructions) as
case OperandType.InlineVar:
case OperandType.ShortInlineVar:
{
srcIns = Instruction.Create(ins.OpCode,
((VariableDefinition)ins.Operand));
break;
}
@seesharper : I am copying the instructions from the source to the
target one by one
On May 19, 2:41 pm, Jb Evain <[email protected]> wrote:
> Hi,
>
> On Thu, May 19, 2011 at 11:08 AM, srcKode <[email protected]> wrote:
> > What am I doing wrong?
>
> It's hard to say without seeing the code which manipulates the IL. The
> stloc.s and ldloc.s indeed look weird, are you properly adding the
> variables to the body?
>
> Jb
--
--
mono-cecil