MissingMethodException but I don't understand why
c#, reflection, wcf
Solution
You can also use GetMethod(methodName) and than Invoke it. I would advice those two steps if you dynamically creating an assembly. In this way, you can locate that method exist first, and than call it.
Problem
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?