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

Race condition between #r "nuget: package" resolution and FSAC startup #1371

Closed
jbeeko opened this issue May 24, 2020 · 8 comments
Closed

Race condition between #r "nuget: package" resolution and FSAC startup #1371

jbeeko opened this issue May 24, 2020 · 8 comments
Labels
bug language services Problems related to language services - FSAC or FCS scripts Problems with .fsx files

Comments

@jbeeko
Copy link
Contributor

jbeeko commented May 24, 2020

Describe the bug
Files contenting the new #r "nuget: package" sometimes don't get editor services when first opened. No type-checking no hover, line-lens nothing. Just dead text.

Editor services can be kicked off by commenting out the script adding a simple line of code and then uncommenting the script.

Previously reported as part of

To Reproduce
The following script will often not get editing services when first opened.

#r "nuget: Farmer"
open Farmer
open Farmer.Builders

let myStorageAccount = storageAccount {
    name "yourfirststorageaccount"
}
let myWebApp = webApp {
    name "yourFirstFarmerApp"
    setting "storageKey" myStorageAccount.Key
    depends_on myStorageAccount.Name
}
let deployment = arm {
    location Location.NorthEurope
    add_resource myStorageAccount
    add_resource myWebApp
}

deployment
|> Deploy.tryExecute "myResourceGroup" Deploy.NoParameters

Deploy.Az.delete "myResourceGroup"

The F# Output is as follows:

[Error - 1:16:38 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:16:57 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:16:57 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:17:22 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603

However if all of the script is commented out and following line is added:
let foo = 4

All editor services are available for that line. BUT THEN if all of the above script codes is uncommented it also receives all editor services.

At this point the F# Output looks as below. Note the addition of the Message: Cannot find ident for tooltip which seems to be a normal occurrence when the FSAC is working.

[Error - 1:16:38 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:16:57 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:16:57 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:17:22 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 
[Error - 1:18:15 PM] Request textDocument/hover failed.
  Message: Cannot find ident for tooltip
  Code: -32603 

Expected behaviour
Editor services should be available immediately upon opening the file.

Environment (please complete the following information):

  • OS: MacOS 10.15.4, Catalina
  • Ionide version: 4.11.1
  • VSCode version: 1.45.1
  • dotnet SDK version: 5.0 preview 4
  • mono / .Net Framework version: N/A

** Additional Context**
It makes NO difference if VS Code is opened with the script file open or if the file is opened later via the Open menu or if the file is opened by double clicking on it.

@open-collective-bot
Copy link

Hey @jbeeko 👋,

Thank you for opening an issue. We will get back to you as
soon as we can. Also, check out our OpenCollective and consider
backing us.

https://opencollective.com/ionide

PS.: We offer backer support for all backers. Don't forget to add backer label when you start backing us 😄

@baronfel
Copy link
Contributor

Hey @jbeeko, can you double-check your Additional Context section? It looks like you meant to add some logs there but it's just an empty code section for me.

From a first guess, though, I think this is the same presentation of the errors that I'd expect if your script was typechecked as NetFX instead of Net SDK, like we discussed over on the other issue.

@jbeeko
Copy link
Contributor Author

jbeeko commented May 24, 2020

@baronfel I was going to copy the log from #1357 thinking that was the same issue but re-reading your comments there I'm not convinced that is the case.

With this issue described here the log is always short, for example I just recreated it and the log only contains one entry:

[Error - 1:39:57 PM] Request textDocument/hover failed.
  Message: Cached typecheck results not yet available
  Code: -32603 

This is also specific to when I'm using the new #r directive.

Now I think I ran across the race condition issue inter-leaved with this one?

@jbeeko
Copy link
Contributor Author

jbeeko commented May 24, 2020

Anyway I seem to be able to create this issue on demand now so any thing you want checked let me know.

@jbeeko
Copy link
Contributor Author

jbeeko commented May 24, 2020

One further observation is that the trick of restarting Editor services by commenting out the script adding
let foo = 4
and then uncommenting the script ONLY works for the larger Farmer based script above. It does not work for a simple script such as the following

// let add2 i = i + 2
// printfn "%i" (add2 2)

let foo = 4

Strange I know but I've repeated that several times now ¯_(ツ)_/¯

@jbeeko
Copy link
Contributor Author

jbeeko commented Jun 4, 2020

Link to a video showing the effect. This is very repeatable.
https://youtu.be/9uvss4cWAAg

@Krzysztof-Cieslak Krzysztof-Cieslak added bug language services Problems related to language services - FSAC or FCS scripts Problems with .fsx files labels Jun 6, 2020
@isaacabraham
Copy link

I'm not sure if this is that issue, but on latest .NET 5, I see something similar: every time I add or remove a #r nuget, Ionide just dies. No intellisense, no tooltips, nothing updates (existing codelenses stay though!). You have to restart Ionide completely.

@Krzysztof-Cieslak
Copy link
Member

Ok, I think we no longer have race condition as we default to .NET SDK everywhere.

However, #r references are still broken as tracked in #1441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug language services Problems related to language services - FSAC or FCS scripts Problems with .fsx files
Projects
None yet
Development

No branches or pull requests

4 participants