I'm following up on my earlier question: Mono.Cecil: call base class' method from other assembly.
I'm doing the same thing, but if my base class is generic it doesn't work.
//in Assembly A
class BaseVM<T> {}
//in Assembly B
class MyVM : Base<SomeModel> {
[NotifyProperty]
public string Something {get;set;}
}
It weaves the following code:
L_000e: call instance void [AssemblyA]Base`1::RaisePropertyChanged(string)
instead of
L_000e: call instance void [AssemblyA]Base`1<class SomeModel>::RaisePropertyChanged(string)
What is there to change?
In your previous post you indicate that you're using code like:
Obviously, this is not suitable for generics:
When you
Resolve ()
the .BaseType, you're losing the generic instantiation information. You need to recreate the appropriate method call with the proper generic information from the base type.To simplify things, let's use the following methods, taken from the Cecil test suite:
With those, you can rewrite your code as: