I'm creating an assembly via reflection, and then using it to create an instance of a WCF service client.
object obj =
assembly.CreateInstance(
serviceName, true,
BindingFlags.CreateInstance,null,createArgs, null, null);
Type type = obj.GetType();
obj is of type HelloWorldServiceClient.
type.GetMethods() has 14 MethodInfo results. The first one is {Acme.TestService.HelloWorldResponse HelloWorld(Acme.TestService.HelloWorldRequest)}
But when I do
return (T)type.InvokeMember(
"HelloWorld", BindingFlags.InvokeMethod, null, obj, args);
I get a MissingMethodException.
type.ContainsGenericParameters = false.
args is object[1] and contains a single {Acme.TestService.HelloWorldRequest}.
I'm dreadfully confused. Can anyone help me out?