ionide / FSharp.Analyzers.SDK

Library for building custom analyzers for F# / FSAC

Home Page:http://ionide.io/FSharp.Analyzers.SDK/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI fails on projects that contain FSI signature files

enovales opened this issue · comments

Describe the bug
Running the CLI analyzer on a project that contains a signature file fails, with the error could not get context for file %s.

To Reproduce
Steps to reproduce the behaviour:

  1. Create a project and add a signature file to it. FsProjWithFsi.zip
  2. Run FSharp.Analyzers.Cli --project "FsProjWithFsi.fsproj" --verbose
  3. Observe the error could not get context for file %s.

Expected behaviour
The analyzer CLI app shouldn't crash.

Environment (please complete the following information):

  • OS: Win10
  • Ionide version: n/a
  • VSCode version: n/a
  • dotnet SDK version: 5

Additional context
The root cause is that in createContext, FSharpCheckFileResults.ImplementationFile is None, which then short-circuits in runProject.

I'm not sure if signature files should simply be skipped for analysis by default, or if there's still potentially useful output that could be produced.

We should skip analysis of signature files entirely, this is a good catch!