Ale*_*gas 6 code-analysis visual-studio-2008 visual-studio
如何在以下内容中忽略特定的VS代码分析规则(例如CA1305:Microsoft.Globalization):
(假设这些选项都是可能的.)
您可以像这样使用SupressMessage属性: -
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "newValue+1", Justification = "The reason I think its acceptable in this case")]
void SomeMethod()
{
// Some code that would normal cause this Code Analysis message
}
Run Code Online (Sandbox Code Playgroud)
关于方法,属性,类型等
我按照 @TrueWill 对 @AnthonyWJones 答案的评论的建议下载了 FXCop。这给了我 SuppressMessage:
[SuppressMessage("Microsoft.Globalization",
"CA1305:SpecifyIFormatProvider",
MessageId = "System.String.Format(System.String,System.Object)")]
Run Code Online (Sandbox Code Playgroud)
这比原本应该的要困难得多。FXCop 集成到 Visual Studio 中发生了什么?感谢回答者的帮助。
归档时间: |
|
查看次数: |
5689 次 |
最近记录: |