-
Notifications
You must be signed in to change notification settings - Fork 241
Fix S3220 FP: Rule does not take into account generics #8522
Copy link
Copy link
Closed
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.
Milestone
Description
Description
The following code produces a S3220 warning at the Caller.Test<T>(string key) method, even though the generic parameter is crucial to the method's execution.
Repro steps
internal static class Called
{
public static T? Get<T>(params string[] key)
{
ArgumentNullException.ThrowIfNull(key);
return default;
}
public static string? Get(string key)
{
ArgumentNullException.ThrowIfNull(key);
return default;
}
}
internal static class Caller
{
public static T? Test<T>(string key)
{
return Called.Get<T>(key);
}
}Expected behavior
No warning.
Actual behavior
Warning.
Known workarounds
Not without violating S3878.
Related information
I'm using the Visual Studio extension, version 7.5.0.82292
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.