VB.NET:不存在歧义时出现歧义类名错误 [英] VB.NET: Ambiguous class name error when no ambiguity exists

查看:30
本文介绍了VB.NET:不存在歧义时出现歧义类名错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的一个客户报告说,当尝试在 VB.NET 中使用我们的 .NET .DLL 时,他们收到错误:

A client of ours reported that when trying to use our .NET .DLL in VB.NET they receive the error:

错误 BC31429:OurClass"不明确,因为命名空间our.company.nspace"中存在多种具有此名称的成员

error BC31429: 'OurClass' is ambiguous because multiple kinds of members with this name exist in namespace 'our.company.nspace'

我还能够使用包含单行

Dim x as our.company.nspace.OurClass

通常这是因为有几种类型的名称只是大小写不同.但在这种情况下,没有这种歧义.OurClass 不仅在特定命名空间中而且在整个程序集以及项目引用的任何其他程序集中都是唯一的名称.反射器也显示了这一点.也没有同名的班级成员,也经过反射器验证.

Normally this is because there are several types with names differing only in case. But in this case there is no such ambiguity. OurClass is a unique name not only in the specific namespace but in the whole assembly and any other assemblies referenced by the project. Reflector also shows this. There are also no class members with the same name, also verified by Reflector.

还有一个奇怪的事情是,在我创建虚拟项目后,错误并没有立即出现,然后它突然出现,现在它不再消失了.事实上,我什至没有对第一个工作的两次重新编译之间进行任何更改,而第二个则没有.

Also a weird thing is that the error wasn't there immediately after I created the dummy project, and then it suddenly appeared and now it doens't go away anymore. In fact I didn't even change anything between the two recompiles from which the first one worked, and the second didn't.

那么……是什么?

(注意:.DLL 使用并引用了 vjslib (J#),如果有任何相关性的话)

(Note: the .DLL uses and references vjslib (J#), if that is of any relevance)

推荐答案

发现问题.有两个类名重复,一个小写(标记为过时")和一个大写,但都留在代码中.显然不符合 CLS 并且会破坏不区分大小写的 VB.Net.

Found the issue. There are two classes with duplicate names one lowercase (marked as "obsolete") and one uppercase but both left in the code. Not CLS compliant obviously and blows up VB.Net which is not case sensitive.

生成和生成

generateAsync 和 GenerateAsync

generateAsync and GenerateAsync

今天的解决方案是从 GitHub 下载,删除小写的违规者,重新编译并手动添加到项目中,至少直到他们最后发布更新的修复程序.

Solution for today is to download from GitHub, remove the lowercase offenders, recompile and manually add to project at least until an updated fix is posted on their end.

这篇关于VB.NET:不存在歧义时出现歧义类名错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆