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

"Not in a F# project (Still loading...)", but the folder is a dotnet scaffolded .fsproj #1697

Open
ladaltamirano opened this issue Apr 24, 2022 · 43 comments

Comments

@ladaltamirano
Copy link

ladaltamirano commented Apr 24, 2022

Describe the bug

I get a "Not in a F# project (Still loading...)" in status bar, but the folder is a dotnet scaffolded .fsproj

Steps to reproduce

Scaffolded a fs project. cd into the directory. Opened it in vscode.
I set up a global.json with net core 5 version installed in my host.
Set net core version 5 in .fsproj
Set the dotnet variable from settings
Set path env var ordered first to the dotnet core path

Expected behaviour

Ionide should recognize this fsproj

Screenshots

image
image
image

Machine info

  • OS: Windows 10 Pro
  • .NET SDK version: [5.0.100]
  • Ionide version: 6.0.1

Additional context

Full F# Output

Unhandled exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'c:\repos\fs\FirstIonideProject\dotnet' with working directory 'c:\repos\fs\FirstIonideProject'. The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Ionide.ProjInfo.SdkDiscovery.execDotnet(DirectoryInfo cwd, FileInfo binaryFullPath, IEnumerable`1 args) in /_//src/Ionide.ProjInfo/Library.fs:line 34
   at Ionide.ProjInfo.SdkDiscovery.versionAt(DirectoryInfo cwd, FileInfo dotnetBinaryPath) in /_//src/Ionide.ProjInfo/Library.fs:line 105
   at Ionide.ProjInfo.Init.init(DirectoryInfo workingDirectory, FSharpOption`1 dotnetExe) in /_//src/Ionide.ProjInfo/Library.fs:line 244
   at FsAutoComplete.Parser.rootCommand@106-1.Invoke(Boolean backgroundServiceEnabled, Boolean projectGraphEnabled, DirectoryInfo stateDirectory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 111
   at System.CommandLine.Handler.<>c__DisplayClass21_0`3.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at FsAutoComplete.Parser.serilogFlush@238-1.MoveNext() in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 0
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
[Info  - 19:58:07] Connection to server got closed. Server will restart.
Unhandled exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'c:\repos\fs\FirstIonideProject\dotnet' with working directory 'c:\repos\fs\FirstIonideProject'. The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Ionide.ProjInfo.SdkDiscovery.execDotnet(DirectoryInfo cwd, FileInfo binaryFullPath, IEnumerable`1 args) in /_//src/Ionide.ProjInfo/Library.fs:line 34
   at Ionide.ProjInfo.SdkDiscovery.versionAt(DirectoryInfo cwd, FileInfo dotnetBinaryPath) in /_//src/Ionide.ProjInfo/Library.fs:line 105
   at Ionide.ProjInfo.Init.init(DirectoryInfo workingDirectory, FSharpOption`1 dotnetExe) in /_//src/Ionide.ProjInfo/Library.fs:line 244
   at FsAutoComplete.Parser.rootCommand@106-1.Invoke(Boolean backgroundServiceEnabled, Boolean projectGraphEnabled, DirectoryInfo stateDirectory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 111
   at System.CommandLine.Handler.<>c__DisplayClass21_0`3.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at FsAutoComplete.Parser.serilogFlush@238-1.MoveNext() in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 0
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
[Info  - 19:58:07] Connection to server got closed. Server will restart.
Unhandled exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'c:\repos\fs\FirstIonideProject\dotnet' with working directory 'c:\repos\fs\FirstIonideProject'. The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Ionide.ProjInfo.SdkDiscovery.execDotnet(DirectoryInfo cwd, FileInfo binaryFullPath, IEnumerable`1 args) in /_//src/Ionide.ProjInfo/Library.fs:line 34
   at Ionide.ProjInfo.SdkDiscovery.versionAt(DirectoryInfo cwd, FileInfo dotnetBinaryPath) in /_//src/Ionide.ProjInfo/Library.fs:line 105
   at Ionide.ProjInfo.Init.init(DirectoryInfo workingDirectory, FSharpOption`1 dotnetExe) in /_//src/Ionide.ProjInfo/Library.fs:line 244
   at FsAutoComplete.Parser.rootCommand@106-1.Invoke(Boolean backgroundServiceEnabled, Boolean projectGraphEnabled, DirectoryInfo stateDirectory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 111
   at System.CommandLine.Handler.<>c__DisplayClass21_0`3.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at FsAutoComplete.Parser.serilogFlush@238-1.MoveNext() in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 0
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
[Info  - 19:58:08] Connection to server got closed. Server will restart.
Unhandled exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'c:\repos\fs\FirstIonideProject\dotnet' with working directory 'c:\repos\fs\FirstIonideProject'. The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Ionide.ProjInfo.SdkDiscovery.execDotnet(DirectoryInfo cwd, FileInfo binaryFullPath, IEnumerable`1 args) in /_//src/Ionide.ProjInfo/Library.fs:line 34
   at Ionide.ProjInfo.SdkDiscovery.versionAt(DirectoryInfo cwd, FileInfo dotnetBinaryPath) in /_//src/Ionide.ProjInfo/Library.fs:line 105
   at Ionide.ProjInfo.Init.init(DirectoryInfo workingDirectory, FSharpOption`1 dotnetExe) in /_//src/Ionide.ProjInfo/Library.fs:line 244
   at FsAutoComplete.Parser.rootCommand@106-1.Invoke(Boolean backgroundServiceEnabled, Boolean projectGraphEnabled, DirectoryInfo stateDirectory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 111
   at System.CommandLine.Handler.<>c__DisplayClass21_0`3.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at FsAutoComplete.Parser.serilogFlush@238-1.MoveNext() in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 0
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
[Info  - 19:58:09] Connection to server got closed. Server will restart.
Unhandled exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'c:\repos\fs\FirstIonideProject\dotnet' with working directory 'c:\repos\fs\FirstIonideProject'. The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Ionide.ProjInfo.SdkDiscovery.execDotnet(DirectoryInfo cwd, FileInfo binaryFullPath, IEnumerable`1 args) in /_//src/Ionide.ProjInfo/Library.fs:line 34
   at Ionide.ProjInfo.SdkDiscovery.versionAt(DirectoryInfo cwd, FileInfo dotnetBinaryPath) in /_//src/Ionide.ProjInfo/Library.fs:line 105
   at Ionide.ProjInfo.Init.init(DirectoryInfo workingDirectory, FSharpOption`1 dotnetExe) in /_//src/Ionide.ProjInfo/Library.fs:line 244
   at FsAutoComplete.Parser.rootCommand@106-1.Invoke(Boolean backgroundServiceEnabled, Boolean projectGraphEnabled, DirectoryInfo stateDirectory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 111
   at System.CommandLine.Handler.<>c__DisplayClass21_0`3.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at FsAutoComplete.Parser.serilogFlush@238-1.MoveNext() in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Parser.fs:line 0
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
[Error - 19:58:09] Connection to server got closed. Server will not be restarted.
@baronfel
Copy link
Contributor

So I haven't looked into anything else, but as of Ionide 6, .net 6 is required. You'll want to make sure that you have that installed. .net 5 goes out of support in about 2 weeks.

@tomboland
Copy link

I have this problem too. I'm using Manjaro Linux, VSCode 1.66.2, Ionide 6.0.2, And dotnet-sdk 6.0.102.

1651609523_2125_03m2022_2565May
1651609511_2125_03m2022_2559May

@tomboland
Copy link

If I click on the message (Yellow text in the blue status bar, near the bottom right of the first image), I get this:
1651611330_2155_03m2022_579May

@tomboland
Copy link

tomboland commented May 3, 2022

I built the extension from source, and this is the output I get when running it, with the same project as above:

(node:531994) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
DOTNET PATH: /usr/share/dotnet/dotnet
FSAC (NETCORE): '/home/tom/ionide-vscode-fsharp/release/bin/fsautocomplete.dll'
Error activating FSAC: Error: Connection to server got closed. Server will not be restarted.
[LineLens] Activating
[LineLens] Config Changed event
[LineLens] Config Changed event
[LineLens] Installing
[LineLens] Installing
[LineLens] Installed
[LineLens] Installed
Error while activating feature 'msbuild': Error: command 'MSBuild.buildSelected' already exists
[Debugger] registering debug provider
[GitIgnore] gitignore path: /home/tom/WasteOfSpace/.gitignore
[GitIgnore] gitignore path: /home/tom/WasteOfSpace/.gitignore
[PipelineHints] Activating
[PipelineHints] Config Changed event
[PipelineHints] Config Changed event
[PipelineHints] Installing
[PipelineHints] Installing
[PipelineHints] Installed
[PipelineHints] Installed
[InlayHints] Activating F# inlay hints
Error loading projects: Error: Language client is not ready yet
Error while activating feature 'analyzers': Error: Language client is not ready yet
[InlayHints] Getting inlay hints for /home/tom/WasteOfSpace/Program.fs
rejected promise not handled within 1 second: Error: Language client is not ready yet
stack trace: Error: Language client is not ready yet
    at O.sendRequest (/home/tom/ionide-vscode-fsharp/release/webpack:/node_modules/vscode-languageclient/lib/common/client.js:1852:19)
    at Ti (/home/tom/ionide-vscode-fsharp/release/webpack:/src/Core/LanguageService.fs:175:13)
    at /home/tom/ionide-vscode-fsharp/release/webpack:/src/Components/InfoPanel.fs:206:32
    at Object.then (/home/tom/ionide-vscode-fsharp/release/webpack:/Promise.fs:624:21)
    at u (/home/tom/ionide-vscode-fsharp/release/webpack:/Promise.fs:638:54)
    at ku (/home/tom/ionide-vscode-fsharp/release/webpack:/src/Components/InfoPanel.fs:200:13)
    at /home/tom/ionide-vscode-fsharp/release/webpack:/src/Components/InfoPanel.fs:284:25
    at Object.then (/home/tom/ionide-vscode-fsharp/release/webpack:/Promise.fs:624:21)
    at u (/home/tom/ionide-vscode-fsharp/release/webpack:/Promise.fs:638:54)
    at Nu (/home/tom/ionide-vscode-fsharp/release/webpack:/src/Components/InfoPanel.fs:252:9)
    at Iu (/home/tom/ionide-vscode-fsharp/release/webpack:/src/Components/InfoPanel.fs:373:13)
    at /home/tom/ionide-vscode-fsharp/release/webpack:/src/fsharp.fs:89:33
    at r (/home/tom/ionide-vscode-fsharp/release/webpack:/src/fsharp.fs:30:17)
    at /home/tom/ionide-vscode-fsharp/release/webpack:/src/fsharp.fs:89:13
    at g._activate (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:8154)
    at g._waitForDepsThenActivate (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:8096)
    at g._initialize (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:7460)
[LineLens] Config Changed event
[LineLens] Config Changed event
[PipelineHints] Config Changed event
[PipelineHints] Config Changed event

@d4span
Copy link

d4span commented May 15, 2022

I have the same issue when opening an F# project in WSL 2, using the most recent Ionide version. In my WSL, I am running Ubuntu 22.04 and .NET 6.0.5.

@jonaskello
Copy link

jonaskello commented Jun 6, 2022

Same for me, WSL2 ubuntu 20.04, dotnet 6.0.101. The first error I got was dotnet could not be found (altough it is in PATH) and then I set "FSharp.dotnetRoot": "/usr/bin/dotnet" and got still loading in status bar and the "n is not a function" message.

@Jlll1
Copy link

Jlll1 commented Jun 30, 2022

I encountered the same issue. Same story as jonaskello.

@dbrattli
Copy link

dbrattli commented Jul 1, 2022

I've had this bug for a long time and it turned out that I had a bug in my settings. The "FSharp: Dotnet Root" was set to /usr/local/share/dotnet/dotnet (i.e including the binary). When I removed it, or changed it to /usr/local/share/dotnet/ then the bug i.e n is not a function disappeared.

@Jlll1
Copy link

Jlll1 commented Jul 2, 2022

@dbrattli I tried both. Pointing directly at the binary causes the n is not a function message, but pointing it to the root directory causes Ionide to fail to load, because it can't find the sdk for some reason.

@tomboland
Copy link

I already have the path /usr/share/dotnet set, and the binary is /usr/share/dotnet/dotnet. Ionide still complains with the same error. I'm just using the "F# Language Server updated" extension now. Shame.

@baronfel
Copy link
Contributor

baronfel commented Jul 6, 2022

sorry folks - things are languishing a bit due to personal circumstances. if anyone wants to build + run the extension locally and try to reproduce or get a stack trace that could help a lot in narrowing down the root cause.

@tomboland
Copy link

Hi @baronfel .

Do you need more than this? #1697 (comment)

@tomboland
Copy link

@baronfel given some guidance, I'm happy to try and resolve this. It's a completely alien codebase though, and I'm not even all that knowledgeable when it comes to the dependencies. Give me some good directions though, and I'm probably capable of getting to the bottom of it.

@baronfel
Copy link
Contributor

baronfel commented Jul 6, 2022

it looks like the root cause of the OP was not finding the dotnet binary to run, and that's just silly because the binary should be argv[0] for any FSAC instance (because we don't bundle the 'apphost' for FSAC). it should be easy enough to fix on the FSAC codebase, but I'm running into issue with FAKE now :-/

@MikaelUmaN
Copy link

MikaelUmaN commented Jul 23, 2022

Exact same issue for me. And stems from not finding the dotnet installation.

Setting dotnet root to /usr/share/dotnet seems to work, though should not be necessary given regular apt install and

(base) jovyan@Mikael-Surface:~/work/FsAlgo/FsAlgoLib$ whereis dotnet
dotnet: /usr/bin/dotnet /usr/share/dotnet
(base) jovyan@Mikael-Surface:~/work/FsAlgo/FsAlgoLib$ ls -la /usr/bin/dotnet
lrwxrwxrwx 1 root root 22 Jun 22 11:18 /usr/bin/dotnet -> ../share/dotnet/dotnet

I'm using ubuntu:20.04 container on WSL2.

@baronfel
Copy link
Contributor

interesting - I know we've had problems with WSL before, I wonder if that's causing any problems...

the next release should do better all around though - FSAC should pick up the dotnet that it's spawned with, and Ionide itself has better/more detailed/more consistent error messages that guide the user to configuring the dotnet path.

@sleepyfran
Copy link

I was having this exact same issue on macOS, albeit not really sure if it was because the dotnet executable could not be loaded. In my case I was having the same message, but the solution loaded correctly, just with no items in any of the projects I have inside (dependencies seemed to load correctly) and I did not get any error messages anywhere.

I was able to fix it by removing a bunch of versions of the SDK that I had lying around. This was the output of the dotnet uninstall list before removing (when it was not working):

~/dotnet-core-uninstall 4.2s λ ./dotnet-core-uninstall list

This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are:

.NET Core SDKs:
  6.0.400-preview.22330.6  (arm64)  [Used by Visual Studio for Mac. Specify individually or use —-force to remove]
  6.0.203                  (arm64)
  6.0.201                  (arm64)
  3.1.421                  (x64)
  3.1.419                  (x64)

.NET Core Runtimes:
  6.0.6  (arm64)  [Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove]
  6.0.6  (x64)
  6.0.5  (arm64)
  6.0.5  (x64)
  6.0.3  (arm64)
  6.0.3  (x64)

And after removing the preview one + a bunch of older ones:

~/dotnet-core-uninstall λ ./dotnet-core-uninstall list

This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are:

.NET Core SDKs:
  6.0.203  (arm64)  [Used by Visual Studio for Mac. Specify individually or use —-force to remove]

.NET Core Runtimes:
  6.0.6  (arm64)  [Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove]
  6.0.6  (x64)

And now it seems to work magically. Don't know if it's just a coincidence or if it was really caused by any of these versions, but it did happen 100% before uninstalling them.

@draganjovanovic1
Copy link

@sleepyfran did you try final 6.0.400? Everything used to work fine for me before installation of new SDK. I also use macOS (m1 max) + vscode 1.70.0 + ionide 6.0.6 (as 7.0.0 causes all of my CPU cores to go to 100%)

@draganjovanovic1
Copy link

It is definitely SDK 6.0.400 related issue. As soon as I removed it from the system and reverted to 6.0.302 ionide works like a charm again.

Setup:

  • Macbook Pro M1 Max
  • VS Code 1.70.0
  • Ionide: 6.0.6
  • dotnet SDK 6.0.302

@baronfel
Copy link
Contributor

Yes, we've had numerous reports about the 6.0.4xx previews, as well as the 7.0.1xx previews. Just haven't had time to figure out what's going on.

I'll add a pinned issue to this repo saying that we're having issues with them in the meantime, hopefully that will help folks save some troubleshooting time.

@draganjovanovic1
Copy link

@baronfel obviously 6.0.400-preview issues now became 6.0.400 official release issues. Hope you will sort it out soon.

@sleepyfran
Copy link

Yes, we've had numerous reports about the 6.0.4xx previews, as well as the 7.0.1xx previews. Just haven't had time to figure out what's going on.

I'll add a pinned issue to this repo saying that we're having issues with them in the meantime, hopefully that will help folks save some troubleshooting time.

Thanks for the clarification! Any pointers on where to start looking if I were to compile the extension locally to investigate? Would love to help with the investigation 😄

@OnurGumus
Copy link

Hitting the same problem with dev containers. The problem is with dev containers you can't pick a different SDK than 400 at the moment.

@ken-okabe
Copy link

Please resolve this issue.

@baronfel
Copy link
Contributor

baronfel commented Jul 2, 2023

@ken-okabe what kinds of errors are you seeing? can your provide any logs from the F# output panel, and/or logs from project loading (via right-click, show project details)?

@ken-okabe
Copy link

Reading your comment, I have confirmed the existence of the F# output panel. In fact, I tried to identify the cause of this c issue myself, but it has been totally random.
Next time the project fails to load, I will let you know the contents of the error. Thank you.

@baronfel
Copy link
Contributor

baronfel commented Jul 2, 2023

If you were using .net 8 previews and experiencing this issue, the newly-released 7.7.1 version of Ionide should resolve it.

@ken-okabe
Copy link

ken-okabe commented Jul 21, 2023

@ken-okabe what kinds of errors are you seeing? can your provide any logs from the F# output panel, and/or logs from project loading (via right-click, show project details)?

I have the error now.

Ionide for F# v7.7.1

I manage .net version control with symlink.

  1. Download the latest .net binary from
    https://dotnet.microsoft.com/en-us/download/dotnet/7.0
    https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-linux-x64-binaries

  2. Unarchive and place in some directory

image

  1. Create new project directory, and place the symlink to the .net sdk directory

image

  1. Confirm dotnet command works

image

  1. Create new F# console project

image

  1. Launch a VSCode profile that already works with other F# projects

code-insiders --profile fsharp ./

image

  1. Could not find dotnet;

The VSCode built-in terminal has the working dotnet path, just Ionide extension complains

image

image

image

My request:

I want this extension to make sure to use the identical context of the shell as the one the VSCode built-in terminal uses.

Note:

I am writing a book about functional programming using TypeScript and F#.

For TypeScript, the environment is stable, and I could write How to start TypeScript in VSCode, however, for F#, since the Ionide setup has been pretty unstable, I always have trouble to write How to start F# in VSCode, and I feel sorry for the unstability of F# setup that would blocks the beginner to join F# world.

@baronfel
Copy link
Contributor

@ken-okabe did you set the DOTNET_ROOT environment variable when setting up your custom execution environment? That's documented as required in the manual installation instructions for .Net, and we have logic to look for that value if set.

@ken-okabe
Copy link

ken-okabe commented Jul 21, 2023

DOTNET_ROOT

Thanks, actually, I recognize that, but the point is I need .net version control.

Multiple versions of .net SDK coexist side by side, and the global environment variables obviously does not fit the purpose.

The document is for beginners not knowing what they are doing.

For the purpose of running the local .net version, I do alias dotnet=.net/dotnet in .zshrc.

The point is, sometimes this method works in some F# project, but not always.

If a user properly configured the global environment variables, dotnet command of their shell context works anyway. Why does the extension have to look the value when the shell context works?

The bottom line is this should not happen:

image

The VSCode built-in terminal recognizes dotnet path in the working context, but the extension does not.

@baronfel
Copy link
Contributor

Your dotnet binary doesn't behave the way you think it does without that environment variable. The variable is used by a dotnet binary to locate the runtimes available for an installation, and without it you very likely are in a mixed configuration.

If you DO want to continue using your custom install (which is pretty common!) you must set that variable.

In general, what you're describing is an unsupported installation of the .NET tooling, and this extension isn't going to go out of its way to support it. It's just not worth it in terms of development time for us to do so, especially when the rest of the stack won't recognize your install.

@ken-okabe
Copy link

Thanks, then, now I have a question within the range officially supported installation of the .NET tooling.

Select the .NET version to use
https://learn.microsoft.com/en-us/dotnet/core/versions/selection

global.json

{
  "sdk": {
    "version": "6.0.0"
  }
}

If a global.json file is present in the project directory or any parent directory, it will take precedence over the DOTNET_ROOT environment variable.

How Ionide behaves in this case?

As long as I've read your comment for the design, the extension only reads the DOTNET_ROOT variable and not takes account of the global.josn precedence that is officially supported.

If I'm wrong, please correct.

@baronfel
Copy link
Contributor

DOTNET_ROOT determines the folder that sdks/runtimes are located from, and global.json determines which SDK to load from that root. Ionide supports global.json, and DOTNET_ROOT, and has for quite some time now.

Ionide isn't unique in this approach, either - this was chosen specifically to align with how the rest of the world of .NET tooling works with regards to SDK location.

@ken-okabe
Copy link

I see. So far, I have not yet succeeded to work with the multiple .net version here, but I will study further.
Thanks for your commitment.

@sharno
Copy link
Contributor

sharno commented Oct 4, 2023

I have the same issue with dotnet-sdk-6.0 installed via apt-get on pop os
I get this different error message:

[22:25:43 ERROR] [LanguageService] Error starting F# language server: % [Error: Error finding dotnet version, do you have dotnet installed and on the PATH?
	at /home/sharno/.vscode/extensions/ionide.ionide-fsharp-7.12.5/fsharp.js:2:700344
	at /home/sharno/.vscode/extensions/ionide.ionide-fsharp-7.12.5/fsharp.js:2:700434
	at async E.n (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:6206)
	at async E.m (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:6169)
	at async E.l (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:5626)]
[22:25:43 ERROR] [Main] Error activating FSAC: Error: Error finding dotnet version, do you have dotnet installed and on the PATH?
[22:25:43 DEBUG] [Main] Activating features
[22:25:43 ERROR] [Main] Error loading projects: TypeError: Cannot read properties of null (reading 'Found')

I have DOTNET_ROOT defined in my .bashrc

@MangelMaxime
Copy link
Contributor

@sharno I had a similar problem when running VSCode/Ionide inside of .devcontainer and Linux.

It looks like sometimes VSCode doesn't load the profile correctly of something. To work around this issue, I set the VSCode setting FSharp.dotnetRoot to the path of dotnet, in my case is /home/vscode/.dotnet.

You can find the path by running which dotnet.

@sharno
Copy link
Contributor

sharno commented Oct 4, 2023

@MangelMaxime didn't change anything, I added the path of my dotnet in that setting in VSCode and it still gives the same message:

image

@ken-okabe
Copy link

ken-okabe commented Oct 4, 2023

I will share my note that works.

How to setup multiple dotnet versions

// if exists, remove
sudo rm -r /usr/share/dotnet/

@Home
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh

// multiple versions
sh ./dotnet-install.sh -v 7.0.306
//  or https://github.com/dotnet/core/blob/main/release-notes/8.0/install.md
sh ./dotnet-install.sh --channel 8.0.1xx --quality preview;

// make `donet` usable from anywhere 
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
// add these to `.zshrc` etc.


// use dotnet commands
dotnet --list-sdks
dotnet --version

// create new project directory and move into it
mkdir test-fs
cd test-fs

// test the local dotnet status
dotnet --list-sdks
dotnet --version

// specify the local dotnet version
dotnet new globaljson --sdk-version $(dotnet --version) --force
or
dotnet new globaljson --sdk-version 7.0.306 --force
dotnet new globaljson --sdk-version 8.0.100-preview.6.23330.14 --force

//new project will be created with the speficied version: check *.fsproj for TargetFramework
dotnet new console --language F#
code --profile fsharp ./

the ionide configuration for dotnet root should be blank



@magnushammar
Copy link

I will share my note that works.
// if exists, remove
sudo rm -r /usr/share/dotnet/

@ken-okabe Thank you. I had an old .NET 6 ghost in /usr/share/dotnet and when I removed that one Ionide could load projects. Happy times!

My .NET 7 and 8 installed with apt-get from Ubuntus repository is in /usr/lib/dotnet

@ken-okabe
Copy link

@ken-okabe Thank you. I had an old .NET 6 ghost in /usr/share/dotnet and when I removed that one Ionide could load projects. Happy times!

You are welcome 😇

@ken-okabe
Copy link

ken-okabe commented Mar 30, 2024

I would like to share what I've found.

When *.fsproj file is as below:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="./lib/*.fs" />
    <Compile Include="Program.fs" />
  </ItemGroup>

</Project>

*.fs files that already exist in ./lib directory are recognized by this extension, but when a user add a new foo.fs in the directory, the extension does not recognize the new file.

I think simply it should watch new files addition and trigger again.

The workaround for the current issue is obviously, re-launch the VSCode which I'm doing right now, which leads an impression the tool is unstable and unproductive.

@TheAngryByrd
Copy link
Member

I would like to share what I've found.

When *.fsproj file is as below:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="./lib/*.fs" />
    <Compile Include="Program.fs" />
  </ItemGroup>

</Project>

*.fs files that already exist in ./lib directory are recognized by this extension, but when a user add a new foo.fs in the directory, the extension does not recognize the new file.

I think simply it should watch new files addition and trigger again.

The workaround for the current issue is obviously, re-launch the VSCode which I'm doing right now, which leads an impression the tool is unstable and unproductive.

This problem is not as straightforward. ionide/FsAutoComplete#1155, but we be happy for someone to come up with ideas in this area.

@ken-okabe
Copy link

@TheAngryByrd

https://code.visualstudio.com/api/references/vscode-api#FileSystemWatcher

should be able to handle this issue.

ionide-vscode-fsharp obviously starts the initial process when the extension is activated, so using the FileSystemWatcher api, it can restart the initial process.

 

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