I've this code.
MethodInfo method = obj.GetType().GetMethod("Run");
Task task = Task.Factory.StartNew((Action)method.Invoke(obj, null));
I can confirm that obj and method are valid. I can see that the function Run is being invoked as well. But after the method Run completes, I'm getting the below exception :
Message = "Value cannot be null.\r\nParameter name: action"
I'm unable to figure out, which "action" parameter is being referred to here since the function Run doesn't return/accept arguments. Here's the Run method if it helps :
public void Run()
{
Console.WriteLine("I'm here");
}
Aucun commentaire:
Enregistrer un commentaire