Skip to content

NET-1727 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

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