The description of the visual basic variant for S2365 is correct on RSPEC, but the implementation is not.
The implementation checks almost only that the property's type is IArraySymbol, and not what happens inside the body of the getter/setter:
// Current implementation
if (property.ImplementsClause is null
&& !property.Modifiers.Any(x => x.IsKind(SyntaxKind.OverridesKeyword))
&& c.SemanticModel.GetDeclaredSymbol(property) is IPropertySymbol symbol
&& !symbol.IsAutoProperty()
&& symbol.Type is IArrayTypeSymbol)
There is no reference to Clone or the other methods that should be avoided, which even simple cases raise. Example:
Public Interface IBase
Property Evil As Byte() ' Noncompliant: passes all the checks above
End Interface
Expected behavior
Refactor the visual basic implementation to be semantically the same as the C# implementation.
The description of the visual basic variant for S2365 is correct on RSPEC, but the implementation is not.
The implementation checks almost only that the property's type is
IArraySymbol
, and not what happens inside the body of the getter/setter:There is no reference to
Clone
or the other methods that should be avoided, which even simple cases raise. Example:Expected behavior
Refactor the visual basic implementation to be semantically the same as the C# implementation.