sonar-dotnet
sonar-dotnet copied to clipboard
Fix S1656 FN: Self-assignment to Me.Field is not detected
S1656 detects useless self-assignment to field, but does not raise when a field is self-assigned using Me. (like this. in C#).
This can help finding bugs in constructors.
Public Class Sample
Public First, Second As String
Public Sub New(First As String)
Me.First = First 'Compliant
Second = Second 'Noncompliant, as expected
Me.Second = Second 'False Negative
Second = Me.Second 'False Negative
End Sub
End Class
Dear @PavlinII thanks a lot for reporting this. I confirm it's a False Negative. We'll add it to our backlog and fix it sometime in the future.
@pavel-mikula-sonarsource, our VB.NET expert will be thrilled to fix this.
Internal ticket NET-1544