Hi,
I'm trying to do a small experiment with Mono Cecil. I created a
simple program where I would like to call a method that has 2 generic
parameters and takes to parameters, the signature of the method is:
public static Tdestination InvokeHandler<Tsource,
Tdestination>(Int32 signature, Tsource context)
Before I submit the Call instruction to the IL processor, I run the
following code to add the generic types to the call:
MethodDefinition invokeMethodDefinition = FindInvokeHandlerMethod();
MethodReference invokeMethodReference =
property.DeclaringType.Module.Import(invokeMethodDefinition);
invokeMethodReference.GenericParameters.Add(new
GenericParameter("Tsource", attribute.DeclaringType));
invokeMethodReference.GenericParameters.Add(new
GenericParameter("Tdestination", attribute.Property.PropertyType));
But this doesn't seem to have the desired effect, the code results in
the following IL instruction:
L_0012: call !!1 [Common]Common.LazyLoad::InvokeHandler(int32, !!0)
But the it should:
L_0015: call !!1 [Common]Common.LazyLoad::InvokeHandler<class
BusinessEntities.Contact, class
BusinessEntities.EmailAddress>(int32, !!0)
What am I doing wrong ? how can I supply the to generic types ?
Regards,
Niels Bergsma
--
--
mono-cecil