Thanks Jb

All working now

On Fri, Jun 11, 2010 at 6:49 PM, Jb Evain <[email protected]> wrote:
> On Fri, Jun 11, 2010 at 8:11 AM, Simon Cropp <[email protected]> wrote:
>> I believe you will have the same issue as me if you try to call
>> OnPropertyChanged on a base class.
>
> Well, the issue is a one liner here.
>
> When you call Resolve () on the BaseType, if the type is defined in
> another assembly, the resolver will have to open this assembly to give
> you the corresponding TypeDefinition. Then you get its
> MethodDefinition and you pass it to the ILProcessor.
>
> The issue here is that you're calling into a method defined in another
> assembly. So I changed:
>
>                        var callOnPropertyChanged = 
> cilWorker.Create(OpCodes.Call,
> onPropertyChanged);
>
> to:
>
>                        var callOnPropertyChanged = 
> cilWorker.Create(OpCodes.Call,
> type.Module.Import (onPropertyChanged));
>
> and you're all set.
>
> Now Cecil here should throw when it tries to emit a method defined in
> another assembly.
>
> --
> Jb Evain  <[email protected]>
>
> --
> --
> mono-cecil

-- 
--
mono-cecil

Reply via email to