-
What language is this for?
C# -
Which rule?
S1172 Remove this parameter ‘…’, whose value is ignored in the method. -
Why do you believe it’s a false-positive/false-negative?
Parameter is definitely used but warns with this message:
....\SomeClass.cs(16,38): warning S1172: Remove this parameter 'context', whose value is ignored in the method.
-
Using SonarQube Community Edition Version 8.9.6 (build 50800)
SonarScanner for MSBuild 5.13
Using the .NET Framework version of the Scanner for MSBuild -
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
sample code:
using System.IO;
namespace SonarScan
{
public class SomeClass
{
public SomeClass()
{
}
public long GetPublicCount(object context)
{
return GetPrivateCount(context);
}
private long GetPrivateCount(object context)
{
try
{
using (var ms = new MemoryStream())
{
return ms.Length;
}
}
catch
{
SomeOtherMethod(context);
throw;
}
}
private void SomeOtherMethod(object _)
{
// not implemented
}
}
}