Closed sakno closed 4 years ago
The method reference in IL inserted as
instance !0 [netstandard]System.Collections.Generic.IReadOnlyList`1<!!T>::get_Item(int32)
Maybe it should be as follows:
instance !!T [netstandard]System.Collections.Generic.IReadOnlyList`1<!!T>::get_Item(int32)
Closing this task, I found an issue: GetMethodFromHandle
requires the second argument for the method handle obtained from the generic type.
Hi,
I suppose you already figured it out, but given the error message, I'd expect the following to work (not tested though):
Ldtoken(PropertyGet(typeof(IReadOnlyList<>), "Item"));
Here is the correct code:
Ldtoken(PropertyGet(Type<IReadOnlyList<T>>(), "Item"));
Pop(out RuntimeMethodHandle method);
Ldtoken(Type<IReadOnlyList<T>>());
Pop(out RuntimeTypeHandle type);
var getter = MethodBase.GetMethodFromHandle(method, type);
Hi Lucas!
I found interesting issue when trying to obtain
RuntimeMethodHandle
:The exception is
There are two possible roots of this problem: