S4275: Sonarqube displays "Refactor this getter so that it actually refers to the field" error even when the right variable is returned

Hi,

Please find the details below,

  • SonarQube version: 6.7

  • Error observed: S4275: “Refactor this getter so that it actually refers to the field ‘__cashLess’”, even when the right variable is returned. An extra underscore is prefixed to the actual variable name in the error message.

  • Language: VB .Net

*Steps to reproduce:

Public Class Class1
Private Withevents _cashLess as CashLess

Public Property CashLess() As CashLess
Get
Return _cashLess 
End Get
Set(ByVal value As CashLess)
_cashLess = value
End Set
End Property

End Class

Public Class CashLess

End Class

thanks @Jones_J , it seems the analyzer gets confused by WithEvents - if that is removed, it won’t be confused anymore

I’ve opened https://github.com/SonarSource/sonar-dotnet/issues/2774 to track this problem