False positive for S1172 - Unused method parameters should be removed

I’m using SonarLint in Visual Studio 2019 16.8 preview 5. The following C# code generates a false positive for S1172, “Unused method parameters should be removed”.

private static int Example(int a, int b)
=> (a, b) switch
{
(1, ) => 1,
(
, 1) => 1,
(_, _) => 0,
};

Hi @Wayne_VanWeerthuizen,

Welcome to our community. I tried to reproduce your issue, but the code example doesn’t compile on Vs 2019 16.8 Preview 6. When I add the discard patterns, the issue doesn’t trigger the FP.

We already S1172 issue with tuples reported here that you might be facing.