WPF 应用程序:Microsoft.Maintainability#CA1506 签名无效 FxCop 违规
我有一个 WPF 解决方案,当我在其上运行 FxCop 时(准确地说,当我在启用代码分析的情况下构建它时),规则集设置为 Microsoft 所有规则(还有一些其他规则集可以执行此操作) ,以及),它给了我以下错误:
CA0001: Rule=Microsoft.Maintainability#CA1506, Target=My.Project.Namespace.App : Signature is not valid.
这似乎指的是作为我的应用程序入口点的 Application
子类。据我所知,类签名似乎没有什么是无效的。谷歌搜索该错误,发现了一些其他 CA0001/CA1506 违规行为,但没有具体涉及“签名无效”。错误(CA1506似乎是“避免过度的类耦合”,尽管我发现有人有我的错误,但“集合在枚举期间被修改”;这和我的错误似乎都与过度耦合无关)。
I have a WPF solution, and when I run FxCop on it (well, when I build it with Code Analysis enabled, to be precise), with the rule set set to Microsoft All Rules (there are a few other rule sets that do this, as well), it gives me the following error:
CA0001: Rule=Microsoft.Maintainability#CA1506, Target=My.Project.Namespace.App : Signature is not valid.
This seems to refer to the Application
subclass that is my application's entry point. Nothing seems to be invalid about the class signature, as far as I can tell. Googling the error brought up some other CA0001/CA1506 violations, but nothing specifically regarding the "Signature is not valid." error (CA1506 seems to be "Avoid excessive class coupling", although I found someone with my kind of error but with "Collection was modified during enumeration"; neither that nor my error seem to have anything to do with excessive coupling).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 CA001 文档,此错误是由自定义规则中的缺陷或托管代码分析工具中的未知缺陷引起的。听起来该错误正在报告代码分析引擎由于签名无效而无法加载/执行 CA1506 规则,但由于您使用的是标准 Microsoft 规则集,这似乎是一个令人费解的错误。
MSDN 文档建议您尝试以下操作:
如果检查代码分析报告没有产生其他信息,您可能需要检查您的开发环境,看看 Visual Studio 中配置代码分析的方式是否存在问题。您甚至可以尝试在 Visual Studio 上进行修复。
According to the CA001 documentation, this error is caused by a defect in a custom rule or an unknown defect in the managed code analysis tool. It sounds like the error is reporting that the code analysis engine is unable to load/execute the CA1506 rule due to an invalid signature, but since you are using the standard Microsoft rule sets this seems to be a puzzling error.
The MSDN documentation suggests you try the following:
If an examination of the code ananlysis report does not yield additional information, you may want to check your development environment to see if there is an issue with the way code analysis is configured within Visual Studio. You might even try to do a repair on Visual Studio.