Skip to content

F# intellisense sometimes stops working #12982

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

Closed
Tracked by #12964
daniel-wojcik opened this issue Apr 13, 2022 · 62 comments · Fixed by #13313
Closed
Tracked by #12964

F# intellisense sometimes stops working #12982

daniel-wojcik opened this issue Apr 13, 2022 · 62 comments · Fixed by #13313
Assignees
Labels
Area-LangService-AutoComplete autocomplete/intellisense Bug Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Regression
Milestone

Comments

@daniel-wojcik
Copy link

I noticed that sometimes Intellisense in F# editor is not working (can't find any pattern): there are no member prompts, no syntax coloring and F12 key is also not functional. After spending some time to find the solution I came to conclusion that it is enough to delete project.assest.json file from obj project folder. After a few seconds after deleting this file all Intellisense functionality is restored.

Windows 10 21H2
VS 2022 17.2.0. Preview 2.0 and 3.0

@daniel-wojcik daniel-wojcik changed the title F# intellisense sometimes stopped working F# intellisense sometimes stops working Apr 13, 2022
@vzarytovskii vzarytovskii mentioned this issue Apr 13, 2022
12 tasks
@kerams
Copy link
Contributor

kerams commented Apr 13, 2022

I'm seeing something similar with FSharp.sln. It seems like I need to run Build.cmd every time before I open VS, otherwise the F# integration is completely dysfunctional.

@dsyme dsyme added Area-LangService-AutoComplete autocomplete/intellisense Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. labels Apr 20, 2022
@vzarytovskii
Copy link
Member

I've checked the latest 17.2 preview as well as 17.3 from main, and don't see it anymore. I will close it for time being.

@daniel-wojcik
Copy link
Author

@vzarytovskii I simply don't understand why this issue was closed - have you in any way verifed it? I'm constantly experiencing this problem, also on newest VS 17.2.0 Preview 6. Below two merged screenshots: upper before deleting obj/project.asset.json, lower: after deleting.

FS_Intellisense_Problem

@vzarytovskii
Copy link
Member

@vzarytovskii I simply don't understand why this issue was closed - have you in any way verifed it? I'm constantly experiencing this problem, also on newest VS 17.2.0 Preview 6. Below two merged screenshots: upper before deleting obj/project.asset.json, lower: after deleting.

FS_Intellisense_Problem

I explained why I closed it - I was unable to reproduce it on the latest 17.2 and 17.3. on VisualFsharp solution with which I work daily.

I will reopen it since apparently, it needs more investigation. The problem is to get it to reproduce so we can debug it.

@vzarytovskii vzarytovskii reopened this May 4, 2022
@kerams
Copy link
Contributor

kerams commented May 4, 2022

VisualFSharp.sln is still broken for me every time (it feels like) I open it without doing a restore with Build.cmd. git clean -xfd did not help.

@vzarytovskii
Copy link
Member

vzarytovskii commented May 4, 2022

VisualFSharp.sln is still broken for me every time (it feels like) I open it without doing a restore with Build.cmd.

This is the problem, I don't see it, I have it currently open and everything seems to be fine (I'm on the latest 17.2 preview).

It's hard to debug something which does not reproduce :(

Do you not run build.cmd whatsoever?

@vzarytovskii
Copy link
Member

vzarytovskii commented May 4, 2022

Building it for the first time with build.cmd is required for tooling to work properly, unfortunately.
cc @KevinRansom

@kerams
Copy link
Contributor

kerams commented May 4, 2022

Building it for the first time with build.cmd is required for tooling to work properly, unfortunately.

The first time after cloning/clean, I know, that's not the problem.

My routine:

  • open the solution, see that nothing works, close it
  • run Build.cmd and once the restore is complete, ctrl-c (I used to let the whole build finish, but it's not necessary - it seems the restore bit is important, which aligns with @daniel-wojcik's findings)
  • open the solution again, integration works
  • work on some autocompletion fixes, build the VS integration in VS and debug it in an experimental instance
  • finish, close the solution, go to bed
  • the next day go to step 1

I might have seen this on different solutions, but it must be fairly rare. Also pretty sure I didn't experience this with preview versions of 17.1.

@vzarytovskii
Copy link
Member

Building it for the first time with build.cmd is required for tooling to work properly, unfortunately.

The first time after cloning/clean, I know, that's not the problem.

My routine:

  • open the solution, see that nothing works, close it
  • run Build.cmd and once the restore is complete, ctrl-c (I used to let the whole build finish, but it's not necessary - it seems the restore bit is important, which aligns with @daniel-wojcik's findings)
  • open the solution again, integration works
  • work on some autocompletion fixes, build the VS integration in VS and debug it in an experimental instance
  • finish, close the solution, go to bed
  • the next day go to step 1

Hm, I see. I will try to repro with these steps.

Build.cmd is also needed for building the Proto compiler.

Can you try opening compiler service solution and see if anything is different for you? It's in the service directory.

@kerams
Copy link
Contributor

kerams commented May 4, 2022

explorer_6wA7fNB5fj

Failed to restore FSharp.Test.Utilities flashed by in the status bar. VS is perfectly idle now.

@kerams
Copy link
Contributor

kerams commented May 4, 2022

Interestingly build.cmd does not help with this solution. When I try to do a build in VS, I get C:\Program Files\dotnet\sdk\6.0.300-preview.22204.3\Sdks\Microsoft.DotNet.Arcade.Sdk\Sdk not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json. VisualFSharp works though.

@vzarytovskii
Copy link
Member

vzarytovskii commented May 4, 2022

Before I started digging too deep, @cartermp, sorry for pinging, but do you maybe know where should I start looking, or maybe this rings a bell to you?

@cartermp
Copy link
Contributor

cartermp commented May 4, 2022

I wouldn't have a clue, but given there are two indicators (delete project.assets.json and the "failed to restore" message) it's likely a nuget restore failure. I don't know how to debug these though. I'd suggest pulling in someone from the project system or nuget client team to help figure it out.

@vzarytovskii
Copy link
Member

@daniel-wojcik by any chance, do you have a sample solution you can reproduce it every time?

@daniel-wojcik
Copy link
Author

@vzarytovskii unfortunatelly I have no such solution which could be shared, but even on this one I'm using the problem occurs from time to time - no repro steps.

@vzarytovskii vzarytovskii mentioned this issue May 10, 2022
7 tasks
@kerams
Copy link
Contributor

kerams commented May 11, 2022

This has somehow gotten even worse in 17.3 Preview 1. I'm now regularly seeing the same problems in projects outside of VisualFSharp.sln almost without fail.

fake build -t run, which does a Paket restore, sometimes helps (some projects occasionally start working). The only remedy that appears to be reliable is deleting the .vs folder while VS is closed.

@vzarytovskii
Copy link
Member

This has somehow gotten even worse in 17.3 Preview 1. I'm now regularly seeing the same problems in projects outside of VisualFSharp.sln almost without fail.

fake build -t run, which does a Paket restore, sometimes helps (some projects occasionally start working). The only remedy that appears to be reliable is deleting the .vs folder while VS is closed.

I'm looking at it now, do you maybe have some public repo in mind you've seen it reproducing?

@kerams
Copy link
Contributor

kerams commented May 11, 2022

Sure, I've opened https://github.com/Zaid-Ajaj/Fable.Remoting at random (for the first time in a long time).

I had Fable.Remoting.DotnetClient/Proxy.fs and Fable.Remoting/MsgPack/Write.fs opened from last time. Proxy.fs was the active tab and after a while I started getting tooltips, but proper syntax coloring did not kick in until I reopened the tab. Write.fs was OK after I switched to it.

Then I reopened VS and the active Proxy.fs loaded up normally. Then I switched to Write.fs and nothing was working when the background tasks had finished. Reopening the tab did not help at all and other files in the MsgPack project behaved exactly the same with F# integration completely busted.

.NET SDK:
Version: 7.0.100-preview.4.22252.9
Commit: 6bc31786a8

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.100-preview.4.22252.9\

global.json file:
Not found

Host:
Version: 7.0.0-preview.4.22229.4
Architecture: x64
Commit: 9c37a3b3eb

.NET SDKs installed:
6.0.300 [C:\Program Files\dotnet\sdk]
7.0.100-preview.4.22252.9 [C:\Program Files\dotnet\sdk]

@vzarytovskii
Copy link
Member

Ok, let me try and debug the completion provider and language service to see if I can have a repro locally.

@vzarytovskii
Copy link
Member

Oh boy...

Latest Int Preview, just by installing the vsix, release version, VS is not under debug:

  1. Don't pre-build Fable-Remoting (only have tools restored).
  2. Open Fable.Remoting.sln, packages were restored.
  3. Open Fable.Remoting.DotnetClient/Proxy.fs via picker (Ctrl-T).
  4. Colouring kicked in straight away.
  5. IntelliSense did show up on external JsonConvert symbol, as well as internal FableJsonConverter
  6. Navigation did work too.
  7. Open Fable.Remoting/MsgPack/Write.fs (different project).
  8. Only basic colouring kicks in.
  9. IntelliSense did not show up on both internal and external symbols. Even if triggered manually.
  10. Navigation did not work.
  11. Verify steps 7-10 in different projects, same behaviour.
  12. Close and re-open solution, now it acts all-the-way around, for example, last document which was open is Fable.Remoting/MsgPack/Write.fs, the colouring and intellisence works there, but when I switch back to Fable.Remoting.DotnetClient/Proxy.fs (which worked before), I don't get colouring or intellisense, and it seems to notkick in if rebuilt.

Same behaviour with cleaned up artifacts, but with pre-built Fable-Remoting using build.cmd script:

Okay, it seems I can work with it.

FYI @dsyme @KevinRansom @KathleenDollard @TIHan
It sounds like it may be related to BuildGraph, or FSharpDocument changes from #12305

@kerams
Copy link
Contributor

kerams commented May 11, 2022

So I am not completely loco, good to have a repro. The workaround of deleting .vs can be narrowed down to closing all tabs before exiting VS.

@vzarytovskii vzarytovskii self-assigned this Jun 17, 2022
@vzarytovskii vzarytovskii moved this from Not Planned to In Progress in F# Compiler and Tooling Jun 17, 2022
@vzarytovskii vzarytovskii added this to the 17.3 milestone Jun 17, 2022
@kerams
Copy link
Contributor

kerams commented Jun 18, 2022

Looks OK, thanks.

@charlesroddie
Copy link
Contributor

Great that this is fixed. Is 17.3 imminent? If there is a 17.2.x after the current one may I suggest this gets put in that. F# in VS is unusable without the fix.

Servicing Updates are releases of targeted fixes for critical quality, performance, reliability, or security issues.

This is one of these!

@vzarytovskii
Copy link
Member

vzarytovskii commented Jun 19, 2022

Great that this is fixed. Is 17.3 imminent? If there is a 17.2.x after the current one may I suggest this gets put in that. F# in VS is unusable without the fix.

Servicing Updates are releases of targeted fixes for critical quality, performance, reliability, or security issues.

This is one of these!

It will unlikely make it to 17.2. It has been released already and I'm not sure there will be another servicing release.
I can suggest installing vsix for 17.2 as a workaround.

@charlesroddie
Copy link
Contributor

I can suggest installing vsix for 17.2 as a workaround.

This will work in my org, but it may be impossible to communicate this to all F# users. Maybe temporary notifications at the top of the main forums would work (slack, this repo, fsharp community forum), linking to the comment #12982 (comment) . @ReedCopsey @dsyme is that reasonable?

I believe a large proportion of F# users will just conclude that it the language doesn't work, until VS 17.3 is out.

@rfreytag
Copy link

rfreytag commented Jun 27, 2022

StackOverflow questions/answers get good search ranking so the question I posted "Visual Studio F# Intellisense stopped working" pointing back to this GitHub discussion #12982 may help get the word out.

If you have a better answer than the answer I cobbled together then please post and I will up vote.

@kerams
Copy link
Contributor

kerams commented Jun 27, 2022

I'm not sure there will be another servicing release

If F# needs a critical fix, which this one arguably is, will the VS release team tell you tough luck? Do we only get to piggyback on someone elses's hotfix? Sad!

@rfreytag
Copy link

rfreytag commented Jun 28, 2022

@kerams I had this problem and it was critical. But then I restarted VS and recompiled and the Intellisense came back. Does this not work for you or others?

See: https://stackoverflow.com/questions/72741952/visual-studio-f-intellisense-stopped-working

@AlgorithmsAreCool
Copy link

@rfreytag This did not work for me. After VS fell into a bad state, I couldn't get it back even after rebuilds, cleans, restarts and reboots.

I had to fallback to using VSCode.

@vzarytovskii
Copy link
Member

vzarytovskii commented Jun 28, 2022

@rfreytag This did not work for me. After VS fell into a bad state, I couldn't get it back even after rebuilds, cleans, restarts and reboots.

I had to fallback to using VSCode.

I am not sure VS 17.3 preview with the fix has been released yet. Or did you install VSIX and it doesn't work for you?

@AlgorithmsAreCool
Copy link

@vzarytovskii To be clear, I am referring to the situation before your fix. (Thank you very much for your efforts btw!)

I assume this fix will remediate my issues with VS

@vzarytovskii
Copy link
Member

@vzarytovskii Vlad Zarytovskii FTE To be clear, I am referring to the situation before your fix. (Thank you very much for your efforts btw!)

I assume this fix will remediate my issues with VS

Oh, got it. Sorry for troubles. We will also try to make it into 17.2 servicing release (cc @kerams).

@kerams
Copy link
Contributor

kerams commented Jun 28, 2022

@vzarytovskii, great news, thanks.

@rfreytag, it's a workaround, but an annoying one. You really don't want to do that every day (sometimes multiple times) for 2 months.

@vzarytovskii
Copy link
Member

Visual Studio 2022 version 17.3 Preview 3 and Visual Studio 2022 version 17.2.6 were released, and include a fix.

Repository owner moved this from In Progress to Done in F# Compiler and Tooling Jul 13, 2022
@dsyme
Copy link
Contributor

dsyme commented Jul 13, 2022

@vzarytovskii Thank you and others so much for all your hard work on this - I know how much effort it has been, to identify the root of the problem and expediting the fixes into the release branches.

@mauriciomagni
Copy link

mauriciomagni commented Dec 14, 2022

Hello Everybody
I am experiencing this problem in version 17.4.3 of Visual Studio. I think it started in version 17.4.1 or 17.4.0.
My solution builds without errors and/or warnings and executes as expected. But Intellisense does not work.
I have tested the SmallFSharpSolution and it works as expected.
I have tried moving from net6 to net7, removing .vs folder, cleaning and rebuilding the solution, repairing Visual Studio, doing a partial load of the solution with just the needed project, but nothing has solve the problem.
I have noticed that for the first files in the solution intellisense works, but not for the last ones.
One more thing: the editor shows an Object null reference error signaling the m in module, at the beginning of a file where intellisense did not work.

Captura de pantalla 2022-12-14 095921

Captura de pantalla 2022-12-14 100013

@T-Gro
Copy link
Member

T-Gro commented Dec 14, 2022

Hello Everybody I am experiencing this problem in version 17.4.3 of Visual Studio. I think it started in version 17.4.1 or 17.4.0. My solution builds without errors and/or warnings and executes as expected. But Intellisense does not work. I have tested the SmallFSharpSolution and it works as expected. I have tried moving from net6 to net7, removing .vs folder, cleaning and rebuilding the solution, repairing Visual Studio, doing a partial load of the solution with just the needed project, but nothing has solve the problem. I have noticed that for the first files in the solution intellisense works, but not for the last ones. One more thing: the editor shows an Object null reference error signaling the m in module, at the beginning of a file where intellisense did not work.

Captura de pantalla 2022-12-14 095921 Captura de pantalla 2022-12-14 100013

Is updating/trying 17.5.0 Preview 2.0 an option for you?
This looks very similar to a problem we spotted in October and which was fixed in the meantime. Before that, it exhibited in the same way, I believe for projects that were using .fsi signature files.

@T-Gro
Copy link
Member

T-Gro commented Dec 19, 2022

(issue resolved, was related to double listing of a file within the same .fsproj. Checking how best to report it and if there could be any legit situation of intentionally wanting to compile the same file twice)

@daniellittledev
Copy link

I'm running into this issue when using fsi files and a project reference (fsi files are in the referenced project). In the upstream project syntax highlighting stops working and when trying to inspect type information an error is shown.

internal error: Object is not set to an instance of an object.

Microsoft Visual Studio Professional 2022
Version 17.4.5
VisualStudio.17.Release/17.4.5+33403.182
Microsoft .NET Framework
Version 4.8.09032

Visual F# Tools   17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools

image

@vzarytovskii
Copy link
Member

I'm running into this issue when using fsi files and a project reference (fsi files are in the referenced project). In the upstream project syntax highlighting stops working and when trying to inspect type information an error is shown.

internal error: Object is not set to an instance of an object.

Microsoft Visual Studio Professional 2022
Version 17.4.5
VisualStudio.17.Release/17.4.5+33403.182
Microsoft .NET Framework
Version 4.8.09032

Visual F# Tools   17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools

image

17.4.5 didn't get a fix, please try on 17.5

@daniellittledev
Copy link

daniellittledev commented Feb 22, 2023

@vzarytovskii are we talking VS 17.5 or F# 17.5, I've checked VS updates, is this a preview? how would I install it?

@vzarytovskii
Copy link
Member

@vzarytovskii are we talking VS 17.5 or F# 17.5, I've checked VS updates, is this a preview? how would I install it?

VS, should be able to download normally here
https://visualstudio.microsoft.com/downloads/

@daniellittledev
Copy link

Awesome, looks like it was released yesterday https://learn.microsoft.com/en-au/visualstudio/releases/2022/release-notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-AutoComplete autocomplete/intellisense Bug Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Regression
Projects
Archived in project