Open ladaltamirano opened 2 years ago
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.
I have this problem too. I'm using Manjaro Linux, VSCode 1.66.2, Ionide 6.0.2, And dotnet-sdk 6.0.102.
If I click on the message (Yellow text in the blue status bar, near the bottom right of the first image), I get this:
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
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.
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.
I encountered the same issue. Same story as jonaskello.
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.
@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.
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.
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.
Hi @baronfel .
Do you need more than this? https://github.com/ionide/ionide-vscode-fsharp/issues/1697#issuecomment-1116681813
@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.
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 :-/
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.
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.
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.
@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%)
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:
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.
@baronfel obviously 6.0.400-preview issues now became 6.0.400 official release issues. Hope you will sort it out soon.
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 😄
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.
Please resolve this issue.
@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)?
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.
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 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.
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
Unarchive and place in some directory
code-insiders --profile fsharp ./
dotnet
; The VSCode built-in terminal has the working dotnet path, just Ionide extension complains
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.
@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.
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:
The VSCode built-in terminal recognizes dotnet
path in the working context, but the extension does not.
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.
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.
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.
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.
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
@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
.
@MangelMaxime didn't change anything, I added the path of my dotnet in that setting in VSCode and it still gives the same message:
I will share my note that works.
// 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
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 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 😇
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.
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 newfoo.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. https://github.com/fsharp/FsAutoComplete/issues/1155, but we be happy for someone to come up with ideas in this area.
@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.
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
Machine info
Additional context
Full F# Output