[英]MissingMethodException when calling to a class library from third-party application
I'm getting a MissingMethodException (referencing a specific method) when calling a method in a company library from a third-party application with scripting, OnBase. 从第三方应用程序使用脚本OnBase调用公司库中的方法时,出现MissingMethodException(引用特定方法)。 The object the method is called on already exists and succeeds other calls before this point.
调用该方法的对象已经存在,并且在此之前可以成功进行其他调用。
Things I've confirmed: 我已经确认的事情:
Also of note is that the script editor's code completion in OnBase can't find the method either, but it also succeeds building. 还要注意的是,脚本编辑器在OnBase中的代码完成也无法找到该方法,但它也可以成功构建。
To clarify, assembly 1 is referenced by the script and contains the method that's coming back missing, and assembly 2 is referenced by assembly 1 and the script both.
为了清楚起见,程序集1被脚本引用,并且包含丢失的方法,而程序集2和脚本都引用了程序集2。 Assembly 2 works in all cases, assembly 1 works except this one method.
程序集2在所有情况下均有效,而程序集1在该情况下除外。
The reason this was happening was that assembly 1 and the script were referencing different versions of assembly 2, so when we were trying to pass in an object defined in assembly 2 to the method in assembly 1, it was from a version that didn't match and so what was missing was a method with that specific signature, ie DoStuff(v1.Foo) existed but DoStuff(v2.Foo) didn't. 发生这种情况的原因是程序集1和脚本引用了程序集2的不同版本,因此当我们尝试将程序集2中定义的对象传递给程序集1中的方法时,它来自的版本没有匹配,因此缺少的是具有特定签名的方法,即存在DoStuff(v1.Foo)但没有DoStuff(v2.Foo)。 Obviously, the error only stated that DoStuff(Foo) was missing.
显然,该错误仅表明缺少DoStuff(Foo)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.