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

Running on project with TargetFrameworks including net6.0 fails with: "The exception has been reported." #618

Open
Thorium opened this issue Nov 23, 2023 · 14 comments

Comments

@Thorium
Copy link
Member

Thorium commented Nov 23, 2023

Trying the tool with one sample:

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

Expected: Run and produce a lot of issues.

Actual:

Lint failed while analysing FunStripe.fsproj.
Failed with: The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: One or more errors seen during provided type setup)
Stack trace:    at FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.Error[b](ErrorLogger x, Exception exn) in D:\workspace\_work\1\s\src\fsharp\ErrorLogger.fs:line 390
   at FSharp.Compiler.CompilerImports.TcImports.ImportTypeProviderExtensions(CompilationThreadToken ctok, TcConfig tcConfig, String fileNameOfRuntimeAssembly, ILScopeRef ilScopeRefOfRuntimeAssembly, FSharpList`1 runtimeAssemblyAttributes, Entity entityToInjectInto, FSharpEvent`1 invalidateCcu, Range m) in D:\workspace\_work\1\s\src\fsharp\CompilerImports.fs:line 1395
   at [email protected](Unit unitVar0) in D:\workspace\_work\1\s\src\fsharp\CompilerImports.fs:line 1570
   at FSharp.Compiler.CompilerImports.PrepareToImportReferencedFSharpAssembly@1581.Invoke(Unit unitVar0) in D:\workspace\_work\1\s\src\fsharp\CompilerImports.fs:line 1590
   at Microsoft.FSharp.Primitives.Basics.List.collectToFreshConsTail[T,TResult](FSharpFunc`2 f, FSharpList`1 list, FSharpList`1 cons) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 439
   at Microsoft.FSharp.Primitives.Basics.List.collect[T,TResult](FSharpFunc`2 f, FSharpList`1 list) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 447
   at FSharp.Compiler.CompilerImports.k@808-28(TcImports tcImports, FSharpList`1 _arg5) in D:\workspace\_work\1\s\src\fsharp\CompilerImports.fs:line 1672
   at FSharp.Compiler.CompilerImports.RegisterAndImportReferencedAssemblies@1659-4.Invoke(CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\CompilerImports.fs:line 1659
   at FSharp.Compiler.CompilerImports.BuildNonFrameworkTcImports@1910-1.Invoke(CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\CompilerImports.fs:line 1910
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 757
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct)
   at <StartupCode$FSharp-Compiler-Service>.$IncrementalBuild.f@728-103(CompilationGlobalsScope resource, FSharpChoice`2 res)
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 752
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct, FSharpOption`1 _arg1) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 1028
   at Internal.Utilities.Library.Eventually.steps[T](CancellationToken ct, FSharpOption`1 swinfo, Eventually`1 e) in D:\workspace\_work\1\s\src\fsharp\absil\illib.fs:line 913
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct, FSharpOption`1 swinfo) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 1028
   at <StartupCode$FSharp-Compiler-Service>.$IncrementalBuild.toCancellableAux@854-4[a](CancellationToken ct, Eventually`1 e)
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 1108
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 1108
   at <StartupCode$FSharp-Compiler-Service>.$IncrementalBuild.GetCheckResultsBeforeSlotInProject@1218-1.Invoke(CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\IncrementalBuild.fs:line 1218
   at <StartupCode$FSharp-Compiler-Service>[email protected](CancellationToken ct) in D:\workspace\_work\1\s\src\fsharp\service\service.fs:line 689
   at <StartupCode$FSharp-Compiler-Service>[email protected](CompilationThreadToken ctok) in D:\workspace\_work\1\s\src\fsharp\service\Reactor.fs:line 223
--- 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.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 250
   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.lintProject(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Core\Application\Lint.fs:line 395
   at FSharpLint.Console.Program.start(ParseResults`1 arguments, ToolsPath toolsPath) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Console\Program.fs:line 122

@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

This one is not working in the master branch either.

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

@Thorium does linting the solution (instead of the project file) yield a different stack trace?

@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

No it's the same. I found the issue:
The project file has:
<TargetFrameworks>net6.0;net472;netstandard2.1</TargetFrameworks>

FSharpLint is compiled with net5.0.
If I add that to the TargetFrameworks, it works:
<TargetFrameworks>net5.0;net6.0;net472;netstandard2.1</TargetFrameworks>

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

FSharpLint is compiled with net5.0.
If I add that to the TargetFrameworks, it works:

Ok thanks, then this is a duplicate of #336 . Closing.

@knocte knocte closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

I think the problem was not .NET Framework, but rather that the project was targeting only more recent .NET than what FSharpLint uses.

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Oh, oops! Reopening.

@knocte knocte reopened this Nov 23, 2023
@knocte knocte changed the title Failed with: "The exception has been reported." Running on project with TargetFrameworks including net6.0 fails with: "The exception has been reported." Nov 23, 2023
@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

Weirdly enough I have other projects that do work with these ones:

<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net48;netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>

@Numpsy
Copy link
Contributor

Numpsy commented Nov 23, 2023

Is is related to that FunStripe project having type providers (FSharp.Data) in it?

@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

this has too and it works fine: https://github.com/Thorium/ClearBank.Net

@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

It does fail for some provided types thing:

System.Exception: 'The design-time type 'System.Boolean' utilized by a type provider was not found in the target reference assembly set '[tgt assembly FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;
 tgt assembly System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a;
 tgt assembly FSharp.Data.Csv.Core, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data.Html.Core, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data.Http, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data.Json.Core, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data.Runtime.Utilities, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data.WorldBank.Core, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259;
 tgt assembly FSharp.Data.Xml.Core, Version=6.2.0.0, Culture=neutral, PublicKeyToken=49286adf818aa259]'. You may be referencing a profile which contains fewer types than those needed by the type provider you are using.'

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

It does fail for some provided types thing:

That looks like a different bug, please file a new ticket (and I bet it's related to the fact that the project you're targetting is net7.0? judging by the 7.0 version of FSharp.Core mentioned in the error...)

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

That looks like a different bug, please file a new ticket

And don't delete your "minimal repro" msg please :)

@Thorium
Copy link
Member Author

Thorium commented Nov 23, 2023

F# version is not related to .net version. FunStripe uses F# 7 on .NET 6. But that's the same config that the other mentioned ClearBank.NET, which does work.
The minimal repo didn't replicate the issue, so there is more going on than just the sln file.

@knocte
Copy link
Collaborator

knocte commented Nov 24, 2023

F# version is not related to .net version.

I was not referring to F# version but to FSharp.Core (nuget pkg) version, which, in the last releases of .NET match their release dates (7.0 is released when .NET7.0 is released, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants