HI,
I am facing runtime issue while calling abstract base class
constructor/function from derived class constructor. Both of these classes
were not exists in existing assembly. I have added these both abstract and
derived class. My programs complies fine but while execution it throws
error as – “System.InvalidProgramException: Common Language Runtime
detected an invalid program”.
Please find the below code snippet to call abstract base class function
from derived class constructor.
IEnumerable<MethodDefinition> methods = baseType.GetMethods
//.GetConstructors
foreach (MethodDefinition method in methods)
{
if (method.Name == "AttachShadow”)
{
MethodReference mr2 = method;
// I replaced above statement with MethodReference mr2 =
originalModule.Import(method); but programs fails at compile time as it was
not able to find the scope for the method
newMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Call,
mr2));
newMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Unbox_Any,
method.ReturnType));
break;
}
}
Can you please help me to resolve the error.
Thanks,
Dhananjay
--
--
--
mono-cecil
---
You received this message because you are subscribed to the Google Groups
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.