On Wed, Jun 30, 2010 at 8:18 PM, Gábor Kozár <[email protected]> wrote:
> Please have a look at it and tell me if I'm doing something wrong!

You're not properly cloning the method attributes. Adding:

newMethodDef.ImplAttributes = methodDef.ImplAttributes;

Make it work.

As a side note, how you clone interfaces look a bit dangerous:

newTypeDef.Interfaces.Add (interfaceTypeRef.Resolve ().Clone ());

It means that you take a type, for instance IEnumerable<string>, that
you resolve to a type definition, that will give you IEnumerable<T>
defined in mscorlib, then you create a new object that looks like it
(but clone doesn't deal with generic parameters, so you'll have just
IEnumerable), and you add it to a type without adding it to a module.
Looks dangerous all right :)

-- 
Jb Evain  <[email protected]>

-- 
--
mono-cecil

Reply via email to