Search code examples
c#sonarlint

Mark as false positive


how can I mark a false positive in Sonarmint? Adding just //NOSONAR was not working for me.

((IClientChannel)channel).Close();

It's saying I should review this cast because there's no type in this project that implements both interfaces. That's clear as IClientChannel comes from System.ServiceModel.IClientChannel and channel is my WCF channel.

Best regards


Solution

  • The question is in fact "How to suppress compiler/analysis warnings in Visual Studio" because SonarLint embeds its own SonarAnalyzer for C# and VB.Net which rely on Roslyn. And one way is to use the #pragma warningspreprocessor directive : https://msdn.microsoft.com/en-us/library/441722ys.aspx