fsprojects / fsprojects/FSharpLint

FL0034: False positive with C# Action<XXX>

Open
#481 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
327
Forks
74
PR merge metrics
No merged PRs in 30d

Description

Description

Call a C# method expecting a parameter of type Action<XXX> with a fsharp fun and you will get the false-positive.

Repro steps

For example, when using Python.Included, do:

Installer.add_LogMessage (fun x -> Log.Debug x) // FL0034
//Installer.add_LogMessage (Log.Debug) // Code is invalid
Expected behavior

No issue reported as call-site doesn't allow such code.

Actual behavior

Warning raised.

Known workarounds

Not aware of any workaround.

Related information
  • Operating system: Win10
  • Branch: VS extension
  • .NET Runtime: 4.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test entry point is identified. Start by reproducing the Python.Included call on the VS extension branch with .NET 4.8, then trace the diagnostic for the F# function passed to C# Action. Done means the valid call no longer raises FL0034.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, fsharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.