Skip to content

Missed opportunity to use Where - false positive #7936

Closed

Description

@sungam3r

CodeQL scanning results: https://github.com/graphql-dotnet/parser/security/code-scanning/888?query=ref%3Arefs%2Fheads%2Fmaster

This is a false positive for a pattern like that

foreach (var i in items)
    if (condition(i)) return i;

Activity

  1. baywet commented on Sep 1, 2026

    @baywet
    Contributor

    Hi @sungam3r
    I've put together a fix for this in #22484 because I also keep running into this thing in multiple repositories. Let me know what you think!

    (Although I work at Microsoft, I'm not from the codeql team and should be considered an external contributor in this context)

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions