Skip to content

NET-3532 Fix S2583 FP: Any called two times #9780

Closed

Description

@PavlinII

Description

S2583 is raising when a collection is checked for Any with two distinct conditions

Reproducer

        Private Sub Solve(Ns() As Node)
            If Ns.Any(Function(X) X.DAC AndAlso X.FFT) Then
                'Do something
            ElseIf Ns.Any(Function(X) X.DAC OrElse X.FFT) Then  'Noncompliant FP, condition is not the same
                'Do something
            Else
                'AoC
            End If
        End Sub

        Private Class Node

            Public DAC, FFT As Boolean

        End Class

Product and Version

SQ for VS 9.2.0

Activity

  1. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    Internal ticket NET-3532

  2. changed the title [-]Fix S2583 FP: Any called two times[/-] [+]NET-3532 Fix S2583 FP: Any called two times[/+] on Apr 1, 2026
  3. alex-meseldzija-sonarsource commented on Apr 14, 2026

    @alex-meseldzija-sonarsource
    Contributor

    Hi @PavlinII
    this has been fixed in the 10.23 release of our analyzers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    False PositiveRule IS triggered when it shouldn't be.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions