Please see following example (I know it looks stupid. But I have cases with complex classes where that applies.):
Visual BasicPublic Class Class1
Public Function Foo(value As String) As Integer
If If(value?.Length, 0) = 0 Then Return -1
'CRR0027 (false positive)
Return value.Length
End Function
Public Function Bar(value As String) As Integer
If value Is Nothing Then Return -1
If value.Length = 0 Then Return -1
'No CRR0027
Return value.Length
End Function
End Class
Hi Robert,
Thank you for providing the code sample. We are working to support this construction with a null-conditional operator in our "Possible System.NullReferenceException" analysis. We will notify you of our progress.