FSharp.Compiler.Service v34.0 seems to have had a breaking API change
See original GitHub issueDescription
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
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
FSharp.Compiler.Service uses latest TargetFramework ...
After some investigation what seems to be happening is when FSharpChecker.Compile is given an fsx file, it implicitly creates an fsproj file ...
Read more >A definitive guide to API-breaking changes in .NET
Source-level break - an API change that results in existing code written to compile against older version of the API potentially not compiling...
Read more >ASP.NET Core updates in .NET 8 Preview 7
NET 8 Preview 7 is now available and includes many great new improvements to ASP.NET Core. Here's a summary of what's new in...
Read more >FSharp.Compiler.Service
Service package is a component derived from the F# compiler source code that ... expressions and declarations, where names have been resolved to...
Read more >Versioning limitations in .NET - Jon Skeet's coding blog
My guess is that that means there really have been 11 sets of breaking changes, but that they're sufficiently unlikely to cause real...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
More digging – root cause is that the compiler services assembly doesn’t do semantic versioning properly, if at all.
Decompiling the v34.1 compiler services assembly shows that whether by design or oversight there’s a parameter not marked as
[OptionalArgument]
, though the .fsi file check in that added the 2 new arguments marks all arguments with a leading?
–while decompiling the
Create()
call in FSharpLint 0.13.0 shows it’s expanded to the missing method signature with fewer trailing argumentsThis issue no longer reproduces with 0.13.2, now that I’ve tracked the FSharpLint API change between 0.13.1 and 0.13.2.