Skip to content

FSharp.Compiler.Service v34.0 seems to have had a breaking API change #380

@SteveGilham

Description

@SteveGilham

Description

After updating a Fake script to v5.19.1 from v5.19 (which updated from FSharp.Compiler.Service (33.0.1) to FSharp.Compiler.Service (34.0.1)) and incidentally FSharpLint.Core from 0.12.5 to 0.12.10, the linting operation failed with exception

System.MissingMethodException: Method not found: 'FSharp.Compiler.SourceCodeServices.FSharpChecker FSharp.Compiler.SourceCodeServices.FSharpChecker.Create(Microsoft.FSharp.Core.FSharpOption`1<Int32>, Microsoft.FSharp.Core.FSharpOption`1<Boolean>, Microsoft.FSharp.Core.FSharpOption`1<Boolean>, Microsoft.FSharp.Core.FSharpOption`1<Resolver>, Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Core.FSharpFunc`2<System.Tuple`2<System.String,System.DateTime>,Microsoft.FSharp.Core.FSharpOption`1<System.Tuple`3<System.Object,IntPtr,Int32>>>>, Microsoft.FSharp.Core.FSharpOption`1<Boolean>)'.
           at FSharpLint.Application.Lint.lintFile(OptionalLintParameters optionalParams, String filepath)

Repro steps

Use the package versions specified above and run a Fake target like

_Target "Lint" (fun _ ->
  let failOnIssuesFound (issuesFound: bool) =
    Assert.That(issuesFound, Is.False, "Lint issues were found")
  try
    let settings =
      Configuration.SettingsFileName
      |> Path.getFullName
      |> File.ReadAllText

    let lintConfig =
      FSharpLint.Application.ConfigurationManagement.loadConfigurationFile settings
    let options =
      { Lint.OptionalLintParameters.Default with Configuration = Some lintConfig }

    !!"**/*.fsproj"
    |> Seq.collect (fun n -> !!(Path.GetDirectoryName n @@ "*.fs"))
    |> Seq.distinct
    |> Seq.map (fun f ->
         match Lint.lintFile options f with
         | Lint.LintResult.Failure x -> failwithf "%A" x
         | Lint.LintResult.Success w ->
           w
           |> Seq.filter (fun x ->
                match x.Fix with
                | None -> false
                | Some fix -> fix.FromText <> "AltCover_Fake")) // special case
    |> Seq.concat
    |> Seq.fold (fun _ x ->
         printfn "Info: %A\r\n Range: %A\r\n Fix: %A\r\n====" x.Info x.Range x.Fix
         true) false
    |> failOnIssuesFound
  with ex ->
    printfn "%A" ex
    reraise())

Expected behavior

Linting happens

Actual behavior

Exception thrown as above

Known workarounds

Back off to previous tool versions.

Related information

  • Operating system - Windows
  • Branch - NuGet released package
  • .NET Runtime, CoreCLR or Mono Version - .net core 3.1.101

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions