Basically, I have a class, let's call it 'Controller', that takes a MethodInfo as a constructor parameter. So, the class that creates this MethodInfo is called 'Descriptor'. The problem is that when 'Controller' calls the MethodInfo, it always fails with:
//MethodInfo creation on Descriptor
var mx = new Func<string>(() => "foo").Method;
//Error caused when Controller runs it
ArgumentException: Method '..anonymous...' declared on type 'Descriptor' cannot be called with instance of type 'Controller'
System.Linq.Expressions.Expression.ValidateCallInstanceType(Type instanceType, MethodInfo method)
The 'Controller' class is completely off limits for me. Do you guys have any suggestion?
Aucun commentaire:
Enregistrer un commentaire