The following code raises warning S3928: The parameter name 'theParameter' is not declared in the argument list.
with SonarAnalyzer version 8.33.0.40503.
public async Task MethodAsync(string theParameter)
{
CheckParameters();
await SomeAsyncOperation(theParameter);
void CheckParameters()
{
if (theParameter == null)
{
throw new ArgumentNullException(nameof(theParameter)); // S3928
}
}
}
I’m unsure whether this is false positive or expected behavior. I guess it is false positive.
BTW: The local function is introduced to fix S4457.