Fsharp: Visual Studio 2019 hangs with "Locating the symbol under the caret..." in F# source file

Created on 15 Mar 2019  路  5Comments  路  Source: dotnet/fsharp

When editing F# source files in my solution, I frequently experience a total hang in Visual Studio 2019 / 16.0.0 Preview 4.2, and I have to kill VS. When hanging, the CPU use of VS is close to 0, and memory doesn't seem unreasonable either.

Now for the important details.

Twice when this has happened, I have noticed that it was in connection with manually renaming a function-local let-binding (first time) and function parameter (second time). I started renaming the identifier declaration itself, then went on to rename its use in the function. After changing a few of them, suddenly VS hangs completely with the text "Locating the symbol under the caret..." leftmost in the status bar.

This is reproducible in the sense that I can restart VS and try to do the same thing over again, and VS hangs in exactly the same place again.

If I change the use of the identifier before changing the declaration of the identifier, then VS won't hang.

Unfortunately I am not able to grab this code and put it into a simple solution and reproduce it there. I will have to try to reduce my solution in order to create a repro, and this may take some time since I'm rather busy. Hopefully I can find some time this weekend. (Note to self: rev 1979, DisplayActor.fs, finnSkiftTilstanderForDato, change parameter "dato" to "tid" to reproduce. First case: earlier rev, change "dummies" to reproduce.)

Known workarounds

Edit in some other way, not necessarily outside of VS.

Can e.g. change the usages of the identifier before changing the declaration of the identifier, and then it won't hang.

Related information

Severity: Low, since workaround exists and this doesn't happen too frequently.

Area-External regression

Most helpful comment

As of #6339 we no longer update the status bar, so I will close this issue.

As a recap:

  • There is a bug in the VS status bar that can cause a deadlock if a component on the UI thread posts a message to it while another component on another thread does the same
  • The F# tools for VS have ctrl+click to go to definition, and pressing or holding ctrl while the caret is over any F# symbol will post a message to the status bar and asynchronously find the definition of the symbol under the caret
  • This can eventually cause VS to deadlock, often unreliably
  • We have a temporary fix out to no longer post status text
  • The VS platform will provide a proper fix in 16.1, at which point we can continue to post messages to the status bar

All 5 comments

Thanks @BentTranberg we noticed this the other day internally. There appears to be a regression in the status text bar itself; under certain circumstances it can deadlock VS as two components attempt to update status text.

As a workaround, you can hide the status bar with:

Tools > Options > Environment > General -- uncheck show status bar

In some cases a dialog box appears over VS, titled "Microsoft Visual Studio", saying "Formatting pasted text...", also containing a progress bar at the bottom in a state with green bars running across it, and a Cancel button. Same result - hung state.

@cartermp, I assume based on what you write that you don't need a repro from me. Let me know if you do need a repro.

As of #6339 we no longer update the status bar, so I will close this issue.

As a recap:

  • There is a bug in the VS status bar that can cause a deadlock if a component on the UI thread posts a message to it while another component on another thread does the same
  • The F# tools for VS have ctrl+click to go to definition, and pressing or holding ctrl while the caret is over any F# symbol will post a message to the status bar and asynchronously find the definition of the symbol under the caret
  • This can eventually cause VS to deadlock, often unreliably
  • We have a temporary fix out to no longer post status text
  • The VS platform will provide a proper fix in 16.1, at which point we can continue to post messages to the status bar
Was this page helpful?
0 / 5 - 0 ratings