Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with exception on solution #580

Closed
cmeeren opened this issue Oct 30, 2022 · 18 comments
Closed

Fails with exception on solution #580

cmeeren opened this issue Oct 30, 2022 · 18 comments

Comments

@cmeeren
Copy link

cmeeren commented Oct 30, 2022

I have installed FSharpLint as a global tool and am running dotnet fsharplint lint on a solution. After a few seconds, it fails:

PS C:\...\MySolution> dotnet fsharplint lint .\MySolution.sln
Lint failed while analysing .\MySolution.sln.
Failed with: Assembly: netstandard, full path: System.Int32
Stack trace:    at FSharp.Compiler.TypedTree.CcuThunk.EnsureDerefable(String[] requiringPath) in D:\workspace\_work\1\s\src\fsharp\TypedTree.fs:line 5142
   at FSharp.Compiler.TypedTree.NonLocalEntityRef.TryDeref(Boolean canError) in D:\workspace\_work\1\s\src\fsharp\TypedTree.fs:line 3160
   at FSharp.Compiler.TypedTree.EntityRef.Resolve(Boolean canError) in D:\workspace\_work\1\s\src\fsharp\TypedTree.fs:line 3243
   at FSharp.Compiler.TypedTree.EntityRef.get_Deref() in D:\workspace\_work\1\s\src\fsharp\TypedTree.fs:line 3255
   at FSharp.Compiler.TypedTreeOps.stripTyEqnsA(TcGlobals g, Boolean canShortcut, TType ty) in D:\workspace\_work\1\s\src\fsharp\TypedTreeOps.fs:line 736
   at FSharp.Compiler.TypedTreeOps.stripTyEqnsWrtErasure(Erasure erasureFlag, TcGlobals g, TType ty) in D:\workspace\_work\1\s\src\fsharp\TypedTreeOps.fs:line 793
   at FSharp.Compiler.TypedTreeOps.typeAEquivAux(Erasure erasureFlag, TcGlobals g, TypeEquivEnv aenv, TType ty1, TType ty2) in D:\workspace\_work\1\s\src\fsharp\TypedTreeOps.fs:line 990
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr callersRetAddrSlot, IntPtr callTarget, IntPtr retVal)
   at FSharp.Compiler.TypedTreeOps.typeEquiv(TcGlobals g, TType ty1, TType ty2) in D:\workspace\_work\1\s\src\fsharp\TypedTreeOps.fs:line 1049
   at FSharp.Compiler.CompilerDiagnostics.OutputExceptionR@595(StringBuilder os, Boolean canSuggestNames, StringBuilder os@595, Exception error) in D:\workspace\_work\1\s\src\fsharp\CompilerDiagnostics.fs:line 667
   at FSharp.Compiler.CompilerDiagnostics.OutputPhasedDiagnostic(StringBuilder os, PhasedDiagnostic err, Boolean flattenErrors, Boolean suggestNames) in D:\workspace\_work\1\s\src\fsharp\CompilerDiagnostics.fs:line 1666
   at FSharp.Compiler.Diagnostics.FSharpDiagnostic.CreateFromException(PhasedDiagnostic exn, FSharpDiagnosticSeverity severity, Range fallbackRange, Boolean suggestNames) in D:\workspace\_work\1\s\src\fsharp\symbols\SymbolHelpers.fs:line 72
   at FSharp.Compiler.Diagnostics.FSharpDiagnostic.CreateFromExceptionAndAdjustEof(PhasedDiagnostic exn, FSharpDiagnosticSeverity severity, Range fallbackRange, Tuple`2 lastPosInFile, Boolean suggestNames)
   at FSharp.Compiler.Diagnostics.DiagnosticHelpers.oneError@204-1.GenerateNext(IEnumerable`1& next) in D:\workspace\_work\1\s\src\fsharp\symbols\SymbolHelpers.fs:line 205
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 368
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at FSharp.Compiler.Diagnostics.DiagnosticHelpers.ReportDiagnostic@196.GenerateNext(IEnumerable`1& next) in D:\workspace\_work\1\s\src\fsharp\symbols\SymbolHelpers.fs:line 210
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 368
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.report@1578-1(ErrorHandler this, FSharpDiagnosticSeverity sev, PhasedDiagnostic exn) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1579
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.ErrorHandler.diagnosticSink(FSharpDiagnosticSeverity sev, PhasedDiagnostic exn) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1588
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.e@822-8(TcState tcState, TcImports tcImports, TcGlobals tcGlobals, TcConfig tcConfig, ISourceText sourceText, FSharpProjectOptions projectOptions, String projectFileName, FSharpParseFileResults parseResults, FSharpMap`2 moduleNamesDict, String mainInputFileName, FSharpOption`1 loadClosure, Tuple`2[] backgroundDiagnostics, ParsedInput parsedMainInput, ErrorHandler errHandler, IDisposable _arg3) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1840
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.e@822-7(TcState tcState, TcImports tcImports, TcGlobals tcGlobals, TcConfig tcConfig, ISourceText sourceText, FSharpProjectOptions projectOptions, String projectFileName, FSharpParseFileResults parseResults, FSharpMap`2 moduleNamesDict, String mainInputFileName, FSharpOption`1 loadClosure, Tuple`2[] backgroundDiagnostics, ParsedInput parsedMainInput, ErrorHandler errHandler, IDisposable _arg2) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1831
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.e@822-6(TcState tcState, TcImports tcImports, TcGlobals tcGlobals, TcConfig tcConfig, Boolean suggestNamesForErrors, ISourceText sourceText, FSharpProjectOptions projectOptions, String projectFileName, FSharpParseFileResults parseResults, FSharpMap`2 moduleNamesDict, String mainInputFileName, FSharpOption`1 loadClosure, Tuple`2[] backgroundDiagnostics, IDisposable _arg1) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1830
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.f@826-122(TcState tcState, TcImports tcImports, TcGlobals tcGlobals, TcConfig tcConfig, Boolean suggestNamesForErrors, ISourceText sourceText, FSharpProjectOptions projectOptions, String projectFileName, FSharpParseFileResults parseResults, FSharpMap`2 moduleNamesDict, String mainInputFileName, FSharpOption`1 loadClosure, Tuple`2[] backgroundDiagnostics, Unit unitVar) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1823
   at FSharp.Compiler.CodeAnalysis.ParseAndCheckFile.CheckOneFile@1822.Invoke(CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 1822
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\FSharpCheckerResults.fs:line 2160
   at [email protected](CancellationToken _arg1) in D:\workspace\_work\1\s\src\fsharp\absil\illib.fs:line 771
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 404
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
--- End of stack trace from previous location ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 337
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInAnotherThread[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 851
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 886
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1148
   at FSharpLint.Framework.ParseFile.parse(String file, String source, FSharpChecker checker, FSharpProjectOptions options) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Framework\ParseFile.fs:line 42
   at FSharpLint.Framework.ParseFile.parseFile(String file, FSharpChecker checker, FSharpOption`1 projectOptions) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Framework\ParseFile.fs:line 73
   at [email protected](String file) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Application\Lint.fs:line 427
   at Microsoft.FSharp.Primitives.Basics.List.mapToFreshConsTail[a,b](FSharpList`1 cons, FSharpFunc`2 f, FSharpList`1 x) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 241
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 251
   at FSharpLint.Application.Lint.parseFilesInProject@410(OptionalLintParameters optionalParams, Configuration config, FSharpFunc`2 projectProgress, FSharpFunc`2 warningReceived, FSharpChecker checker, FSharpList`1 files, FSharpProjectOptions projectOptions) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Application\Lint.fs:line 424
   at FSharpLint.Application.Lint.lintProject$cont@396(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath, Unit unitVar) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Application\Lint.fs:line 442
   at FSharpLint.Application.Lint.lintSolution$cont@458(OptionalLintParameters optionalParams, String solutionFilePath, ToolsPath toolsPath, Unit unitVar) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Application\Lint.fs:line 483
   at FSharpLint.Application.Lint.lintSolution(OptionalLintParameters optionalParams, String solutionFilePath, ToolsPath toolsPath) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Application\Lint.fs:line 457
   at FSharpLint.Console.Program.start(ParseResults`1 arguments, ToolsPath toolsPath) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Console\Program.fs:line 122

I have cloned FSharpLint locally with the aim of debugging this to find more information, but I don't know how to debug using a local FSharpLint solution. How do I do this? I can't find information about that anywhere.

Alternatively, if you already know what's wrong, feel free to just fix it, of course.

@cmeeren
Copy link
Author

cmeeren commented Oct 30, 2022

Also, I suggest that when it fails like this, it should print the exception message, not just the stack trace.

@knocte
Copy link
Collaborator

knocte commented Oct 30, 2022

am running dotnet fsharplint lint on a solution

Not 100% sure but I think that by using that command, you're using the old nuget package, not the new one.

Please try this instead (which is what my team has in CI steps and works):

$HOME/.dotnet/tools/dotnet-fsharplint lint <yourSlnFile>

@cmeeren
Copy link
Author

cmeeren commented Oct 30, 2022

I get the same error.

Not 100% sure but I think that by using that command, you're using the old nuget package, not the new one.

Then the documentation must be updated, because that's what it says to use everywhere. Also, it sounds weird to me: Which NuGet package is used should be a result of which tool I install using dotnet tool install (and then invoke using dotnet <tool-name>.

@cmeeren
Copy link
Author

cmeeren commented Oct 30, 2022

Note by the way that I can analyze some solutions, while others fail with the error above.

@Thorium
Copy link
Member

Thorium commented Nov 18, 2023

I had one solution that fails with current package version, but running with master-branch here works.

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

I had one solution that fails with current package version, but running with master-branch here works.

Good to know! I'll make a release soon then.

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Good to know! I'll make a release soon then.

Released 0.21.4. @cmeeren can you re-test with this version and inform? Thanks!

@cmeeren
Copy link
Author

cmeeren commented Nov 23, 2023

Same here as #578 (comment) - I have moved on and unfortunately can't prioritize this. But happy that it's likely fixed! Feel free to close.

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

@Thorium can you re-test on your end with 0.21.4 instead of master?

@Thorium
Copy link
Member

Thorium commented Nov 23, 2023

Hmm, still failing on 0.21.4.

Example to replicate:

git clone https://github.com/simontreanor/FunStripe.git
cd FunStripe
cd src
dotnet fsharplint lint FunStripe.fsproj

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Example to replicate:

I thought this bug was about a solution, not a project.

@Thorium
Copy link
Member

Thorium commented Nov 23, 2023

Fails on both FunStripe.sln (with the stack above) and with FunStripe.fsproj.

Edit: Sorry, the stack doesn't look like that anymore

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Fails on both FunStripe.sln

And this was the solution that was working for you with master branch, according to #580 (comment) ?

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Edit: Sorry, the stack doesn't look like that anymore

Please share it with us, cause it might prove that we might be dealing with a different animal.

@Thorium
Copy link
Member

Thorium commented Nov 23, 2023

You are correct. I opened a separate issue: #618

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

And this was the solution that was working for you with master branch, according to

You said in issue #618 that linting FunStripe doesn't work in master either. Then, please, can you try linting the same solution with 0.21.4 that you linted when you wrote this comment: #580 (comment) ? Thanks

@Thorium
Copy link
Member

Thorium commented Nov 23, 2023

I cannot remember what it was, I tried like 10 different sln files now and all worked.
I think this can be closed.

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Thanks

@knocte knocte closed this as completed Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants