开发者

InvokeMember call is throwing MissingMethodException

开发者 https://www.devze.com 2023-01-16 09:33 出处:网络
I am invoking one of the functions from assembly but I am getting MissingMethodException.I have open exe in .netreflector and show that function is available at right place though it is giving error.

I am invoking one of the functions from assembly but I am getting MissingMethodException. I have open exe in .netreflector and show that function is available at right place though it is giving error. Here is the code.

private void button2_Click(objec开发者_高级运维t sender, EventArgs e)
 {
        Assembly obj = Assembly.LoadFrom("Solo4O.exe");
        Type datacrypt = obj.GetType("Orch.DC");

        object[] objects = new object[3];

....

        datacrypt.InvokeMember("GetCryptedXML", BindingFlags.InvokeMethod |
                                                BindingFlags.Static |
                                                BindingFlags.Public,
                               null, datacrypt, objects, null);

}


Your target argument is datacrypt but it should be null, as you're calling a static method (and you're definitely not calling a method on datacrypt).

Beyond that, it's hard to know exactly what's wrong, partly because you haven't shown how you've initialized objects... we don't know what the types involved are. Please show more code. I strongly suspect that one of your argument types is invalid for the method call.

0

精彩评论

暂无评论...
验证码 换一张
取 消