Microsoft.CodeQuality.Analyzers
2.9.1
CA1062
It incorrectly flags tableNames as needing a parameter check for null. In this example, null is checked for and tableNames is given a non-null value in that case.
public TableSet(DbDataReader reader, params string[] tableNames)
{
if (reader == null)
throw new ArgumentNullException("reader", "reader is null.");
if (tableNames == null)
tableNames = Array.Empty<string>();
var index = 0;
do
{
var tableName = (index < tableNames.Length) ? tableNames[index] : ("Table " + index);
m_Internal.Add(new Table(tableName, reader));
index += 1;
}
while (reader.NextResult());
}
Needs special handling in points to analysis to understand that Array.Empty returns a non-null value, not the default maybe-null value.
Needs special handling in points to analysis to understand that Array.Empty returns a non-null value, not the default maybe-null value.
This wasn't actually required (PR: https://github.com/dotnet/roslyn-analyzers/pull/2345), I made a more conservative implementation in analysis where assigning to a parameter on a path causes us to stop tracking the parameter as we cannot null ref due to incoming argument value for the parameter
Most helpful comment
This wasn't actually required (PR: https://github.com/dotnet/roslyn-analyzers/pull/2345), I made a more conservative implementation in analysis where assigning to a parameter on a path causes us to stop tracking the parameter as we cannot null ref due to incoming argument value for the parameter