I am trying to weave an assembly by using mono.cecil library. I am injecting a function call at a place in the assembly. The function call has some optional parameters.
But when I inject without loading any value for optional parameters, I get exception on running the modified assembly
I use the following syntax for this:
tempMethod.Body.Instructions.Add( Instruction.create(Opcodes.Call, methodRef));
where methodRef
is an object of type methodReference
.
methodRef
has one optional argument.. but I am not passing any argument over here (using load instruction)
I assume the problem is in the way I am getting methodRef
. Is there anything specific, which I need to do for getting methods with optional parameters.