The following code fails inspection with 'bindingVariables' is null on at least one execution path
issue. The issue is detected on the line of foreach
loop. Clearly, variable bindingVariables
cannot be null past the first if
statement.
public Dictionary<string, string> BindingVariables { get; set; } = new Dictionary<string, string>();
public void AppendBindingVariables(Dictionary<string, string> bindingVariables)
{
if ((bindingVariables?.Count ?? 0) == 0)
{
return;
}
foreach (var bindingVariable in bindingVariables)
{
BindingVariables[bindingVariable.Key] = bindingVariable.Value;
}
}