从 WSDL 生成的代理类存在 CLS 兼容错误
我尝试从使用 .net 2003 给出的 WSDL 文件生成代理类。当我尝试将此类文件添加到 .net 2003 中的项目时,它在代理类中给出错误,例如“标识符不符合 CLS”代码”
可能是什么原因造成的?
标识符“FinancialTransactionCard.lifecycleStatus”仅在不符合 CLS 的情况下有所不同
[System.Xml.Serialization.XmlElementAttribute("lifecycleStatus")]
public FinancialTransactionCardLifecycleStatus[] lifecycleStatus;
I have tried to generate a proxy class from WSDL file given using .net 2003. When i tried to add this class file to my project which is in .net 2003, Its giving error in proxy class like "Identifier is not in case CLS compliant code"
What might be causing this?
Identifier 'FinancialTransactionCard.lifecycleStatus' differing only in case is not CLS-compliant
[System.Xml.Serialization.XmlElementAttribute("lifecycleStatus")]
public FinancialTransactionCardLifecycleStatus[] lifecycleStatus;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,很少需要遵守 CLS。如果出现此警告/错误是一个令人困扰的问题,那么现在请关闭 CLS。
从我能从错误中发现的内容(大概是翻译过来的)来看,这听起来像是一个冲突,以防万一;例如,以下内容不符合 CLS:
因为不区分大小写的语言(VB.NET 等)无法可靠地使用它。因此,请检查您的 WSDL 和生成的代码,看看是否有任何仅因大小写不同而有所不同的内容。
不过,更好的方法是放弃 .NET 1.1;从任何角度来看,Visual Studio 2003 几乎都已过时。后来的框架和工具修复了广泛的错误(包括安全问题)。
CLS compliance is, in truth, rarely needed. If having this warning/error is a show-stopper, then for now turn off CLS.
From what I can pick out of the error (presumably translated), it sounds like a conflict in case; the following is not CLS compliant, for example:
for the reason that case-insensitive languages (VB.NET etc) can't use it reliably. So check your WSDL and generated code for anything that differs only by case.
A better approach, though, is to move away from .NET 1.1; Visual Studio 2003 is by virtually any measure obsolete. Later frameworks and tool fix a wide range of bugs (including security issues).