简体   繁体   English

从第三方应用程序调用类库时缺少MissingMethodException

[英]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: 我已经确认的事情:

  • Other references from this library work correctly 该库中的其他引用正常工作
  • Method is public 方法是公开的
  • Version of DLL referenced by the script in question has the method (rebuilt the assembly and re-imported it, outputs show current date as created date, and OnBase shows the correct updated version number) 有问题的脚本引用的DLL版本具有该方法(重建程序集并重新导入它,输出将当前日期显示为创建日期,而OnBase显示正确的更新版本号)
  • No versions of the DLL are in the GAC GAC中没有DLL的任何版本
  • Server application has been restarted since importing 自导入以来,服务器应用程序已重新启动

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中的代码完成也无法找到该方法,但它也可以成功构建。

  • What are the more uncommon locations where I should be looking for an old DLL? 我应该在哪里寻找旧的DLL?
  • Are there any OnBase specific locations? 是否有OnBase的特定位置?
  • What other causes can there be? 还有什么其他原因?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM