[英]InvokeMember call is throwing MissingMethodException
I am invoking one of the functions from assembly but I am getting MissingMethodException. 我正在从汇编中调用功能之一,但正在获取MissingMethodException。 I have open exe in .netreflector and show that function is available at right place though it is giving error. 我在.netreflector中打开了exe文件,并显示该函数在正确的位置可用,尽管它给出了错误。 Here is the code. 这是代码。
private void button2_Click(object 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
). 您的target
参数是datacrypt
但应为null
,因为您正在调用静态方法(并且绝对不是在 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. 除此之外,很难确切知道出了什么问题,部分原因是您还没有展示如何初始化objects
……我们不知道所涉及的类型是什么。 Please show more code. 请显示更多代码。 I strongly suspect that one of your argument types is invalid for the method call. 我强烈怀疑您的参数类型之一对于方法调用无效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.