FSharp.Analyzers.SDK
FSharp.Analyzers.SDK copied to clipboard
Analyzer cannot use FSharp.Core 8
Describe the bug
When your analyzer is using a higher version of F# Core (say 8.0.100-beta.23475.2
), it will fail at runtime during loading.
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|25_0()
at System.Reflection.RuntimeMethodInfo.get_ReturnType()
at FSharp.Analyzers.SDK.Client.getAnalyzerFromMemberInfo@61[TContext,a](a mi) in /_//src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.Client.fs:line 69
at FSharp.Analyzers.SDK.Client.analyzerFromMember[TAnalyzerAttribute,TContext](String path, MemberInfo mi) in /_//src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.Client.fs:line 88
at [email protected](MemberInfo mi)
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@240.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 252
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source) in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 1003
at <StartupCode$FSharp-Analyzers-SDK>[email protected](Type t)
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@128.DoMoveNext(b& curr) in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 131
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 113
at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@319[T,TResult](ConcatEnumerator`2 x, Unit unitVar0) in D:\a\_work\1\s\src\FSharp.Core\seqcore.fs:line 320
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@277[T](FSharpFunc`2 f, IEnumerator`1 e, FSharpRef`1 started, Unit unitVar0) in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 281
at Microsoft.FSharp.Collections.Internal.IEnumerator.filter@267.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 283
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source) in D:\a\_work\1\s\src\FSharp.Core\seq.fs:line 1003
at FSharp.Analyzers.SDK.Client`2.LoadAnalyzers(String dir) in /_//src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.Client.fs:line 150
To Reproduce
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="8.0.100-beta.23475.2" />
<PackageReference Include="FSharp.Analyzers.SDK" Version="0.16.0" />
</ItemGroup>
Expected behaviour
Either we tell the user that the F# version should be 7.0.400
instead. Because that is the version the CLI tool is using. Or we find a way around this problem during loading?
We should at the very least provide a better UX.