roslyn-analyzers
roslyn-analyzers copied to clipboard
PH2101 Dereference null - false negative
PH2101 Dereference Null did not trip on this code:
DataGridViewTextBoxCell assignedCell = row.Cells[_colAssignedValue.Index] as DataGridViewTextBoxCell;
if (assignedCell.Value == null)
{
assignedCell.Value = string.Empty;
}
Once IDE0074 was applied, PH2101 did trip on the result:
DataGridViewTextBoxCell assignedCell = row.Cells[_colAssignedValue.Index] as DataGridViewTextBoxCell;
assignedCell.Value ??= string.Empty;
```
Ideally it would have tripped on the original code as well.