Open plainionist opened 10 months ago
Hi @plainionist thanks for reporting this bug!
Can you try running FSharpLint with dotnet 6.x instead of with dotnet 8.x? Just to see if it's a valid workaround.
i tried
dotnet fsharplint --fx-version 6.0.9 lint system\Bake\Bake\Bake.fsproj
but got exactly same error.
Lint failed while analysing system\Bake\Bake\Bake.fsproj. Failed with: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Stack trace: at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList
1 globalProperties)
at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList1 globalProperties, BinaryLogGeneration binaryLogs, FSharpList
1 customProperties) in /_//src/Ionide.ProjInfo/Library.fs:line 641
at <StartupCode$Ionide-ProjInfo>.$Library.loadProject@906(WorkspaceLoader _, FSharpList1 customProperties, BinaryLogGeneration binaryLogs, Dictionary
2 cache, String p) in ///src/Ionide.ProjInfo/Library.fs:line 907`
dotnet fsharplint --fx-version 6.0.9 lint system\Bake\Bake\Bake.fsproj
Shouldn't the fx-version flag be after dotnet and before fsharplint?
@knocte that's correct - the CLI parser used by the .NET Runtime (not the SDK) is very simplistic and only accepts flags between dotnet
and the command to be run.
even though you are right according to dotnet help, it doesn't seem to work for tools
dotnet --fx-version 6.0.9 fsharplint lint system\Bake\Bake\Bake.fsproj
Could not execute because the specified command or file was not found. Possible reasons for this include:
Oh bummer! Then do you mind uninstalling 8.0.100 and try? This way it will run with 6.x or 7.x.
After having uninstalled .NET 8 SDK, .NET 7 has been taken - unsuccessfully
dotnet fsharplint lint system\Bake\Bake\Bake.fsproj
Lint failed while analysing system\Bake\Bake\Bake.fsproj. Failed with: Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Stack trace: at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList`1 globalProperties)
Basically same error message just different verison of System.Runtime not found
After having uninstalled .NET 7 SDK as well, finally, FSharpLint was executed successfully 👍
Oh, so with .NET6 it works? What version of .NET6 do you have?
yes - works with .NET 6 - i have following versions installed
dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.401 Commit: 0906eae6f8
Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.401\
global.json file: Not found
Host: Version: 6.0.9 Architecture: x64 Commit: 163a63591c
.NET SDKs installed: 5.0.301 [C:\Program Files\dotnet\sdk] 6.0.400 [C:\Program Files\dotnet\sdk] 6.0.401 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Download .NET: https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs: https://aka.ms/dotnet/runtimes-sdk-info
but i would prefer being able to install .NET 8 again and still use FSharpLint 😉
but i would prefer being able to install .NET 8 again and still use FSharpLint 😉
Of course, I never stated that this is not a bug. I was trying to see if there's a workaround so that we understand the bug better.
I might push a commit later today that might or not help with this bug; I will let you know so you can test a pre-release.
I might push a commit later today that might or not help with this bug; I will let you know so you can test a pre-release.
@plainionist an update was pushed to nuget, can you test new prerelease version "0.24.1--date20240129-0357.git-d05ca87" please?
dotnet tool update -g dotnet-fsharplint --prerelease Tool 'dotnet-fsharplint' was successfully updated from version '0.24.0' to version '0.24.1--date20240129-0357.git-d05ca87'.
executed with only .NET 6 installed then installed latest .NET 8 again
Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92
.NET SDKs installed: 5.0.301 [C:\Program Files\dotnet\sdk] 6.0.400 [C:\Program Files\dotnet\sdk] 6.0.401 [C:\Program Files\dotnet\sdk] 8.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
and finally got same error again :(
dotnet fsharplint lint system\Bake\Bake\Bake.fsproj
Lint failed while analysing system\Bake\Bake\Bake.fsproj.
Failed with: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Stack trace: at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList1 globalProperties) at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList
1 globalProperties, BinaryLogGeneration binaryLogs, FSharpList1 customProperties) in /_//src/Ionide.ProjInfo/Library.fs:line 842 at <StartupCode$Ionide-ProjInfo>.$Library.loadProject@1176(WorkspaceLoader __, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs, Dictionary2 cache, String p) in /_//src/Ionide.ProjInfo/Library.fs:line 1177 at <StartupCode$Ionide-ProjInfo>.$Library.loadProjectList@1213(WorkspaceLoader __, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs, Dictionary2 cache, FSharpList
1 projectList) in ///src/Ionide.ProjInfo/Library.fs:line 1233
at Ionide.ProjInfo.WorkspaceLoader.Ionide.ProjInfo.IWorkspaceLoader.LoadProjects(FSharpList1 projects, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs) in ///src/Ionide.ProjInfo/Library.fs:line 1241
at FSharpLint.Application.Lint.getProjectInfo(String projectFilePath, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 302
at FSharpLint.Application.Lint.lintProject$cont@397(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath, Unit unitVar) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 441
at FSharpLint.Application.Lint.lintProject(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 396
at FSharpLint.Console.Program.start(ParseResults`1 arguments, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Console/Program.fs:line 133
Ok I tried to reproduce this bug, using dotnet 7.x (in particular 7.0.115), and with the default fsproj generated by the command dotnet new classlib -lang "F#" -o src/Library
, and I didn't get the crash.
@plainionist can you try to reproduce with the same dotnet new
command above, and if that doesn't cause a crash, then I guess you would need to upload your special .fsproj file here.
i can try later - meanwhile here is the content of the project i used for testing - maybe this helps (compile elements removed)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.Collections.ParallelSeq" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.0" />
</ItemGroup>
</Project>
maybe this helps (compile elements removed)
With this I still can't reproduce it. Note I'm testing in Linux. But today a coworker managed to reproduce it (he doesn't repro in Linux, like me, but in Windows he does).
i am testing on windows and even with "default f# classlib template" i get:
dotnet new classlib -lang "F#"
The template "Class Library" was created successfully.
Processing post-creation actions...
Restoring C:\ws\plainionist\temp\temp.fsproj:
Determining projects to restore...
Restored C:\ws\plainionist\temp\temp.fsproj (in 751 ms).
Restore succeeded.
dotnet fsharplint lint temp.fsproj
Lint failed while analysing temp.fsproj.
Failed with: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Stack trace: at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList`1 globalProperties)
at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList`1 globalProperties, BinaryLogGeneration binaryLogs, FSharpList`1 customProperties) in /_//src/Ionide.ProjInfo/Library.fs:line 842
at <StartupCode$Ionide-ProjInfo>.$Library.loadProject@1176(WorkspaceLoader __, FSharpList`1 customProperties, BinaryLogGeneration binaryLogs, Dictionary`2 cache, String p) in /_//src/Ionide.ProjInfo/Library.fs:line 1177
at <StartupCode$Ionide-ProjInfo>.$Library.loadProjectList@1213(WorkspaceLoader __, FSharpList`1 customProperties, BinaryLogGeneration binaryLogs, Dictionary`2 cache, FSharpList`1 projectList) in /_//src/Ionide.ProjInfo/Library.fs:line 1233
I have the same issue, but I have an .net8.0 project.
System.Runtime, Version=8.0.0.0 missing.
We have managed to reproduce the problem in CI: https://github.com/webwarrior-ws/FSharpLint/commits/reproduce-687/
The tricky thing will be to fix it. Maybe switching to .net8.0 is our best bet, but:
Help welcome :)
As a test, I tried setting the roll forward behaviour for the fsharplint tool to latestMajor
(the default in the fsharp-lint nuget package is Major
) and that seems to have got it to run on a .NET 6.0 project that I'm building using the .NET 8.0 SDK.
Note: When I tried it with the 0.24.0 release it didn't produce any results (which sounds like #690), but using the latest preview release worked.
I have the same issue
@xperiandri Does it work if you do
set DOTNET_ROLL_FORWARD=latestMajor
before running fsharplint (using version 0.24.2) ?
I had the same issue using .Net 8 on Linux.
Using DOTNET_ROLL_FORWARD=latestMajor
worked for me.
Workaround:
If you have .NET 8 installed and you get this error, temporarily add following globals.json
to the root:
{
"sdk": {
"version": "6.0.403",
"rollForward": "minor"
}
}
Then you can run FSharpLint. And after results delete the file.
just to confirm @Thorium - that would require installing 6.0.403 too?
My problem is a bit different - i want to simply run it in dotnet8 and target dotnet8, but get the same error.
Is this question for Fake or FSharpLint? This is bit complex because Fake build (wrapper) is different from dotnet.exe (actual compile).
So after latest Fake 6 update, the .NET6 runtime is needed to run Fake and then you can add NET8 runtime if you want to run dotnet.exe compile on .Net 8 targetframework.
What comes to the project e.g. FSharpLint, you can compile that to "only net8" targetframework with this setup in the PR and then the tool enduser only needs NET8.
I installed F# lint as dotnet tool as described in the documentation (version 0.24.0) and then tried to run it for a single fsproj on the command line like this:
dotnet fsharplint lint TheProject.fsproj
and i got:
Lint failed while analysing system\Bake\Bake\Bake.fsproj. Failed with: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Stack trace: at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList
1 globalProperties) at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList
1 globalProperties, BinaryLogGeneration binaryLogs, FSharpList1 customProperties) in /_//src/Ionide.ProjInfo/Library.fs:line 641 at <StartupCode$Ionide-ProjInfo>.$Library.loadProject@906(WorkspaceLoader __, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs, Dictionary2 cache, String p) in /_//src/Ionide.ProjInfo/Library.fs:line 907 at <StartupCode$Ionide-ProjInfo>.$Library.loadProjectList@934(WorkspaceLoader __, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs, Dictionary2 cache, FSharpList
1 projectList) in ///src/Ionide.ProjInfo/Library.fs:line 944 at Ionide.ProjInfo.WorkspaceLoader.Ionide.ProjInfo.IWorkspaceLoader.LoadProjects(FSharpList1 projects, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs) in ///src/Ionide.ProjInfo/Library.fs:line 952 at FSharpLint.Application.Lint.getProjectInfo(String projectFilePath, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 301 at FSharpLint.Application.Lint.lintProject$cont@396(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath, Unit unitVar) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 440 at FSharpLint.Application.Lint.lintProject(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 395 at FSharpLint.Console.Program.start(ParseResults`1 arguments, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Console/Program.fs:line 133Operating System: Window 10
dotnet --info .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.69afb982
Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.101\
.NET workloads installed: Workload version: 8.0.100-manifests.69afb982 There are no installed workloads to display.
Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92
.NET SDKs installed: 5.0.301 [C:\Program Files\dotnet\sdk] 6.0.400 [C:\Program Files\dotnet\sdk] 6.0.401 [C:\Program Files\dotnet\sdk] 7.0.202 [C:\Program Files\dotnet\sdk] 8.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: arm64 [C:\Program Files\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\arm64\InstallLocation] x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download