Skip to content

Fix S3241 FP: Do not raise if the method is used as an argument #7429

Open
@mary-georgiou-sonarsource

Description

Repro steps

void Method(AnInterface foo)
{
    Func(0);
    foo?.DoSomething(Func);

    bool Func(int value) => true; // FP
}

public interface AnInterface
{
    void DoSomething(Func<int, bool> method);
}

Expected behavior

Should not raise an issue, when the delegate of the method is used as an argument.

Known workarounds

Use discard for the output.

Related information

  • C#/VB.NET Plugins version: 9.3

Activity

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

Metadata

Assignees

No one assigned

    Labels

    Area: C#C# rules related issues.Type: 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