标记为误报

Mark as false positive

如何在 Sonarmint 中标记误报?仅添加 //NOSONAR 对我不起作用。

((IClientChannel)channel).Close();

它说我应该审查这个转换,因为这个项目中没有实现这两个接口的类型。这很清楚,因为 IClientChannel 来自 System.ServiceModel.IClientChannelchannel 是我的 WCF 频道。

此致

问题实际上是 "How to suppress compiler/analysis warnings in Visual Studio" 因为 SonarLint 嵌入了它自己的 C# 的 SonarAnalyzer 和依赖 Roslyn 的 VB.Net。一种方法是使用 #pragma warnings 预处理器指令:https://msdn.microsoft.com/en-us/library/441722ys.aspx