Skip to content

redundantNewKeyword only sometimes works, only rarely warns FL0014 #555

@abelbraaksma

Description

@abelbraaksma

Description

It appears as if redundantNewKeyword works only occasionally. I rarely see it warning with FL0014.

Repro steps

The following code doesn't raise FL0014:

new System.Collections.Generic.Dictionary<string, string>() |> ignore
new Guid() |> ignore

Yet the following does:

new Int32() |> ignore

Expected behavior

Unless IDisposable is implemented, it should raise FL0014. This doesn't happen.

Actual behavior

For most real-world code, it doesn't raise "Usage of 'new' keyword here is redundant".

Known workarounds

None

Related information

  • Operating system: Win10/Win11
  • Branch: most recent as of today with dotnet install
  • .NET Runtime, CoreCLR or Mono Version: .NET 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions