I posted this before but didn’t realize that the issue is caused by Option Strict and the analyzer combined.
Using SonarAnalyzer.VisualBasic 8.28.0.36354, VB.Net and .Net Framework 4.8.0.
The following causes a false positive:
S1172: Remove unused procedure parameter ‘SubArg’.
Public Class SurroundingClass
Public Delegate Sub ErrorDelegate(Arg As String)
Public Property Prop As ErrorDelegate
Public Sub Unrelated()
Prop = AddressOf ErrorSub
End Sub
Private Sub ErrorSub(SubArg As String) 'S1172 False positive here.
Dim Stuff As Boolean
End Sub
End Class
Removing the (SubArg As String) to satisfy S1172 causes:
BC36663: Option Strict On does not allow narrowing in implicit type conversions between method ‘Private Sub SubR()’ and delegate ‘Delegate Sub SurroundingClass.ErrorDelegate(Arg As String)’.