Skip to content

NET-2999 Fix S6672 FN: Mismatch in primary constructor is not recognized #9784

Open

Description

@jhinder

Description

Currently only constructor declarations are checked. A logger type mismatch in a primary constructor is not yet recognized.

Reproducer

class A(ILogger<C> logger);
//             ^^^ no diagnostic here despite the mismatch

class B
{
    public B(ILogger<C> logger)
//                  ^^^ S6672: Update this logger to use its enclosing type.
    {
    }
}

class C;

Product and Version

SonarQube for Visual Studio 9.4.0.16052

Activity

  1. pavel-mikula-sonarsource commented on Jan 20, 2026

    @pavel-mikula-sonarsource
    Contributor

    Hi @jhinder,

    Thank you for reporting this case. I confirm it as False Negative

  2. changed the title [-]Fix S6672 FN: Mismatch in primary constructor is not recognized[/-] [+]NET-2999 Fix S6672 FN: Mismatch in primary constructor is not recognized[/+] on Jan 20, 2026
  3. github-actions commented on Jan 20, 2026

    @github-actions
    Contributor

    Internal ticket NET-2999

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 NegativeRule is NOT triggered when it should be.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions