Hi, I feel like I'm missing something obvious, but I have been having trouble with importing a reference to a generic method.
Currently I can clone types along with all their methods, properties, and fields, however I've run into problems when there are generic types. From searching on here it seems that generic types are difficult to deal with. So my question: While going through the instructions of a method, I check the operand type, and if necessary, I import a reference to the operand (if it is something such as a type, field, or method). The IL for the method that I am cloning is: ldarg.0 ldtoken !!T call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call int32 [mscorlib]System.Runtime.InteropServices.Marshal::SizeOf(class [mscorlib]System.Type) callvirt instance uint8[] [mscorlib]System.IO.BinaryReader::ReadBytes(int32) call !!0 MyClass.MyMethod<!!T>(uint8[]) ret The IL instruction that I can't get is: IL_0015: call !!0 MyClass::MyMethod<!!T>(uint8[]) Mono.Cecil seems to choke when I try to import a reference to the operand of that instruction, throwing an InvalidOperationException. I believe it is because it is a generic instance method, but I'm not sure how to get the reference for it. If there's anything else I can provide please let me know, Thanks for the help. -- -- -- 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.
