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

F# Language Services don't start when visible document at startup is a C# file #5170

Closed
ricksladkey opened this issue Jun 12, 2018 · 25 comments
Labels
Area-LangService-API Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Regression
Milestone

Comments

@ricksladkey
Copy link

ricksladkey commented Jun 12, 2018

Revised description of issue:

As far as I can tell, it is not correct (at least for the symptoms I am reporting) that F# Language Services "stop working". In fact, they never start and it is 100% reliable (for me) that if the active document in Visual Studio when it opens is a C# file, F# Language Services never start. I have to switch the active document to a F# file, close Visual Studio, and re-open the (VsVim) solution and then both F# and C# Language services work properly.


Original description of issue:

The problem is basically that F# Language Services simply stop working and don't come back.

Repro steps

  1. Clone https://github.com/jaredpar/VsVim and open VsVim.sln in Visual Studio 2017

  2. Start coding, e.g.

  3. Checkout several different branches in succession "from underneath Visual Studio" while the solution is open (but it is not entirely clear what triggers the behavior)

  4. At some point, all advanced F# language services stop working entirely with no messages: no type inference, no advanced syntax coloring (e.g. no colored module names or mutable variables, goto definition fails, etc.), nothing but comments and keywords remain with syntax coloration.

Expected behavior

Language services eventually become available after, e.g., changing branches.

Actual behavior

Usually it takes about 15 seconds of background language service activity before advanced F# language services become available. However, in the broken state, no matter how long you wait, the language services never comes back.

Known workarounds

Only closing and re-opening the solution and waiting the requisite 15 seconds will fix it.

Related information

  • Windows 7, Version 6.1 (Build 7601: SP1)
  • Visual Studio 15.7.3
  • Microsoft Visual F# Tools 10.1 for F# 4.1, 15.7.0.0
@abelbraaksma
Copy link
Contributor

Thanks for this. @cartermp and I and some others have tried a repro with my own solution. I have come to understand from @dsyme that after a certain timeout or high memory threshold the language services stop. But they don't reset.

@dsyme
Copy link
Contributor

dsyme commented Jun 13, 2018

@ricksladkey Thanks for the repro, we'll take a look.

Does turning off in-memory cross-project references help?

I have come to understand from @dsyme that after a certain timeout or high memory threshold the language services stop.

This is not quite accurate. High memory usage degrades the tools but there is no known cause of them to "stop". If they are perceived to stop while VS continues to function otherwise then we'd consider that a bug, though we always need a repro to be able to make any progress with it.

@chillitom
Copy link
Contributor

I saw this once when switching branches that use the old project file format and others that use the new format, could that be the case here?

@dsyme
Copy link
Contributor

dsyme commented Jun 13, 2018

@chillitom I could absolutely imagine that would confuse the tooling greatly

@Pilchie
Copy link
Member

Pilchie commented Jun 13, 2018

Indeed - that's been a real pain point. When switching, please delete your bin and obj directories, as otherwise parts of the tooling will detect files there and do the wrong thing.

@ricksladkey
Copy link
Author

@dsyme I failed to mention that I already have in-memory cross-project references turned off because the performance was so bad. With it turned on, intellisense for a single identifier used to take up to ten seconds to come up.

@ricksladkey
Copy link
Author

ricksladkey commented Jun 13, 2018

@chillitom All the branches that I use daily (and seem to trigger the problem), are "recent" ones, and the project files themselves are unchanged between the branches.

@ricksladkey
Copy link
Author

It does not seem to be related to memory use, because it is broken right now and Visual Studio is using "only" 458M, whereas it is routinely over 1.5G. On the other hand, it is pleasantly using no CPU, so that is a side benefit!

@cartermp
Copy link
Contributor

@ricksladkey Re this:

With it turned on, intellisense for a single identifier used to take up to ten seconds to come up.

Which version is this exhibited? This was the case in older versions of VS (15.5), but with 15.7.3 I'd be quite surprised if you still saw this.

The only thing I could think of (as per comments here) is that checking out branches where the project file format changes (and thus the project system changes) results in a deaded language service. The new project system can handle these changes in the editor, but switching from that to the old one likely cannot.

@ricksladkey
Copy link
Author

@cartermp It's very possible that the version I had trouble with in-memory cross-project references was 15.5.x or 15.6.x.

As a test, I've turned in-memory cross-project references back on and I'm not seeing the pathological slowness that caused me to turn it off. I'll test further with this setting, but I can already tell you that the "stops working" problem is still present.

@ricksladkey
Copy link
Author

I think I found a repro for the F# stopping working problem. In fact, I can cause the problem without changing branches or changing any files or projects at all.

All I have to do is close Visual Studio with the selected document being a C# file associated one of the non-F# projects in the solution. If I then reopen Visual Studio, that C# file will be the first document window displayed. If I then switch windows to a F# file from an F# project, the F# language services never "start up".

It's true that I have many dozens of lazy loaded documents from previous editing sessions. Anyway, the workaround if that is true is to make sure an F# file is the active window when closing Visual Studio. I'll test that theory.

@dsyme dsyme added Bug Area-LangService-API Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. labels Jun 19, 2018
@ricksladkey
Copy link
Author

Since the repro that I found doesn't resemble the description that I gave in this issue, should I close this issue and open a new one?

As far as I can tell, it is not correct (at least for the symptoms I am reporting) that F# Language Services "stop working". In fact, they never start and it is 100% reliable (for me) that if the active document in Visual Studio when it opens is a C# file, F# Language Services never start. I have to switch the active document to a F# file, close Visual Studio, and re-open the (VsVim) solution and then both F# and C# Language services work properly.

@cartermp
Copy link
Contributor

cartermp commented Jun 28, 2018

@ricksladkey No need, you can just edit the title and maybe paste this paragraph at the top and then put a separator between that an the original issue text. Thanks for reducing this down.

@cartermp
Copy link
Contributor

@ricksladkey Testing on 15.7.4 with an F# console app and a C# library (.NET Core, .NET Standard), I cannot reproduce what you describe. I'll try it with VsVim.

@cartermp
Copy link
Contributor

Hmmm, on a fresh clone:

  1. Open solution
  2. Open Interfaces.cs
  3. Close solution
  4. Re-open solution.
  5. Open an F# file (FSharpUtil.fs)

I'm on parallels on the mac right now so it takes ~5-10 seconds, but the language service for F# does light up for me.

@ricksladkey ricksladkey changed the title F# Language Services stop working entirely F# Language Services don't start when visible document at startup is a C# file Jun 28, 2018
@ricksladkey
Copy link
Author

@jaredpar Can you repro this?

@ricksladkey
Copy link
Author

@cartermp I tried and failed to repro using a minimal two-project solution built from scratch. Then I tried a number of experiments to try to not repro the problem with the full solution, including disabling third-party extensions, reducing the number of open documents, using those two specific .cs and .fs files, etc. but never saw any change in the symptoms.

@cartermp
Copy link
Contributor

I got it to reproduce! 😢

Really strange that this did not reproduce for me on my laptop. But on my desktop, it does.

@cartermp
Copy link
Contributor

cc @TIHan

@jaredpar
Copy link
Member

Can you repro this?

I've seen this a few times in the past but I'd never been able to narrow down a repro. I just tried locally and couldn't. But I don't have an RTM build on this machine. Looks like @cartermp has a repro now though.

@cartermp cartermp added this to the 16.0 milestone Jun 29, 2018
@cartermp
Copy link
Contributor

Unfortunately, I do not know if this is a regression or not. So this will have to be slated for dev16 instead of the current dev15 trains.

@TIHan
Copy link
Contributor

TIHan commented Aug 28, 2018

This should be resolved when we made the Roslyn change to ensure the F# package is loaded.

@cartermp cartermp modified the milestones: 16.0, 15.8 Aug 28, 2018
@cartermp
Copy link
Contributor

Just attempted to reprodue on 15.8.1, and I cannot reproduce this anymore. Which makes sense, since the underlying bug was about not having an F# document open when the solution opens.

@ricksladkey we'll close this out, but if you can reproduce this in 15.8.x again, we can re-open.

@ricksladkey
Copy link
Author

ricksladkey commented Aug 29, 2018

@cartermp I open and close Visual Studio a lot and I had systematically avoided leaving the focus on a C# window when I close it. But I thought to revisit this bug and have tried several times and with Visual Studio 15.8.1 and have not been able to repro the problem. I was worried that it was just "accidentally" gone, but it sounds like you have a handle on the root cause and so closing it makes sense.

Thanks because this improves my quality of life!

@cartermp
Copy link
Contributor

Not a problem! Glad this was sorted out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-API Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Regression
Projects
None yet
Development

No branches or pull requests

8 participants