Ionide-vscode-fsharp: IntelliSense not working, "File not parsed" errors in the output

Created on 21 Dec 2017  路  15Comments  路  Source: ionide/ionide-vscode-fsharp

The IntelliSense (and the code lens type information) suddenly stopped working, even in files it was working before. These are fsx files in a folder, not an actual project.

I reprod by creating an empty folder at C:\IonideRepro, adding a test.fsx file to it with the following content:

let foo = "bar"

let baz a b = a + b

let qux = baz 3 4

Then I start VSCode, and open the C:\IonideRepro, and open the fsx file.
The IntelliSense and the code lense are not working. This is the output in the F# Language Service (server) output:

Running: C:\Users\mvincze.TRAVIX\.vscode\extensions\Ionide.ionide-fsharp-3.15.1/bin/fsautocomplete.exe --mode http --port 8940 --hostPID=8068
[I] 2017-12-21T19:51:40.7757953Z: tracking host PID 8068 [FsAutoComplete]
Resolving startup promise because FSAC printed the 'listener started' message
[I] 2017-12-21T19:51:40.9257972Z: listener started in 72.989 ms with binding 127.0.0.1:8940 [Suave.Tcp.tcpIpServer]

And this is the output in the "F# Language Service" output: (and more errors are appearing as I click around in the file)

[20:51:40 INFO ] listening notification on /notify started
[20:51:40 INFO ] listening notification on /notifyWorkspace started
[20:51:40 DEBUG] REQ (001) -> {workspacePeek}
Data={"Directory":"c:\\IonideRepro","Deep":2,"ExcludedDirs":[".git","paket-files"]}
[20:51:41 DEBUG] RES (001) <- {workspacePeek} in 691 ms: Kind={"workspacePeek"}
Data={"Found":[{"Type":"directory","Data":{"Directory":"c:\\IonideRepro","Fsprojs":[]}}]}
[20:54:16 DEBUG] REQ (002) -> {parse}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","IsAsync":true,"Lines":["let foo = \"bar\"\r","\r","let baz a b = a + b\r","\r","let qux = baz 3 4"],"Version":1}
[20:54:16 DEBUG] REQ (003) -> {declarations}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","Lines":["let foo = \"bar\"\r","\r","let baz a b = a + b\r","\r","let qux = baz 3 4"],"Version":0}
[20:54:17 DEBUG] RES (002) <- {parse} in 588 ms: Kind={"info"}
Data="Request cancelled (exn was System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.\r\nFile name: 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'\r\n   at Microsoft.FSharp.Compiler.CompileOps.GetDefaultSystemValueTupleReference()\r\n   at Microsoft.FSharp.Compiler.CompileOps.DefaultReferencesForScriptsAndOutOfProjectSources@1805.GenerateNext(IEnumerable`1& next)\r\n   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()\r\n   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)\r\n   at Microsoft.FSharp.Compiler.CompileOps.BasicReferencesForScriptLoadClosure(Boolean useFsiAuxLib, Boolean assumeDotNetFramework)\r\n   at Microsoft.FSharp.Compiler.CompileOps.ScriptPreprocessClosure.CreateScriptSourceTcConfig[a](Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, CodeContext codeContext, Boolean useSimpleResolution, Boolean useFsiAuxLib, FSharpOption`1 basicReferences, FSharpFunc`2 applyCommandLineArgs, Boolean assumeDotNetFramework)\r\n   at Microsoft.FSharp.Compiler.CompileOps.ScriptPreprocessClosure.GetFullClosureOfScriptSource(CompilationThreadToken ctok, Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, String source, CodeContext codeContext, Boolean useSimpleResolution, Boolean useFsiAuxLib, LexResourceManager lexResourceManager, FSharpFunc`2 applyCommmandLineArgs, Boolean assumeDotNetFramework)\r\n   at Microsoft.FSharp.Compiler.CompileOps.LoadClosure.ComputeClosureOfSourceText(CompilationThreadToken ctok, Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, String source, CodeContext implicitDefines, Boolean useSimpleResolution, Boolean useFsiAuxLib, LexResourceManager lexResourceManager, FSharpFunc`2 applyCompilerOptions, Boolean assumeDotNetFramework)\r\n   at <StartupCode$FSharp-Compiler-Service>[email protected](ErrorScope _arg30)\r\n   at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.CancellableBuilder.Using[c,d](c resource, FSharpFunc`2 e)\r\n   at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.CancellableModule.delay@751.Invoke(CancellationToken ct)\r\n   at <StartupCode$FSharp-Compiler-Service>[email protected](CompilationThreadToken ctok)\r\n\r\nWRN: Assembly binding logging is turned OFF.\r\nTo enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1.\r\nNote: There is some performance penalty associated with assembly bind failure logging.\r\nTo turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog].\r\n)"
[20:54:17 DEBUG] RES (003) <- {declarations} in 999 ms: Kind={"declarations"}
Data=[{"Declaration":{"UniqueName":"Test_1_of_1","Name":"Test","Glyph":"Module","GlyphChar":"N","IsTopLevel":true,"Range":{"StartColumn":1,"StartLine":1,"EndColumn":1,"EndLine":6},"BodyRange":{"StartColumn":1,"StartLine":1,"EndColumn":18,"EndLine":5},"File":"c:\\IonideRepro\\test.fsx","EnclosingEntity":"M","IsAbstract":false},"Nested":[{"UniqueName":"Test_1_of_1","Name":"baz","Glyph":"Field","GlyphChar":"F","IsTopLevel":false,"Range":{"StartColumn":5,"StartLine":3,"EndColumn":20,"EndLine":3},"BodyRange":{"StartColumn":5,"StartLine":3,"EndColumn":20,"EndLine":3},"File":"c:\\IonideRepro\\test.fsx","EnclosingEntity":"M","IsAbstract":false},{"UniqueName":"Test_1_of_1","Name":"foo","Glyph":"Field","GlyphChar":"F","IsTopLevel":false,"Range":{"StartColumn":5,"StartLine":1,"EndColumn":16,"EndLine":1},"BodyRange":{"StartColumn":5,"StartLine":1,"EndColumn":16,"EndLine":1},"File":"c:\\IonideRepro\\test.fsx","EnclosingEntity":"M","IsAbstract":false},{"UniqueName":"Test_1_of_1","Name":"qux","Glyph":"Field","GlyphChar":"F","IsTopLevel":false,"Range":{"StartColumn":5,"StartLine":5,"EndColumn":18,"EndLine":5},"BodyRange":{"StartColumn":5,"StartLine":5,"EndColumn":18,"EndLine":5},"File":"c:\\IonideRepro\\test.fsx","EnclosingEntity":"M","IsAbstract":false}]}]
[20:54:19 DEBUG] REQ (004) -> {parse}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","IsAsync":true,"Lines":["let foo = \"bar\"\r","\r","let baz a b = a + b\r","\r","let qux = baz 3 4"],"Version":1}
[20:54:19 DEBUG] RES (004) <- {parse} in 26 ms: Kind={"info"}
Data="Request cancelled (exn was System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.\r\nFile name: 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'\r\n   at Microsoft.FSharp.Compiler.CompileOps.GetDefaultSystemValueTupleReference()\r\n   at Microsoft.FSharp.Compiler.CompileOps.DefaultReferencesForScriptsAndOutOfProjectSources@1805.GenerateNext(IEnumerable`1& next)\r\n   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()\r\n   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)\r\n   at Microsoft.FSharp.Compiler.CompileOps.BasicReferencesForScriptLoadClosure(Boolean useFsiAuxLib, Boolean assumeDotNetFramework)\r\n   at Microsoft.FSharp.Compiler.CompileOps.ScriptPreprocessClosure.CreateScriptSourceTcConfig[a](Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, CodeContext codeContext, Boolean useSimpleResolution, Boolean useFsiAuxLib, FSharpOption`1 basicReferences, FSharpFunc`2 applyCommandLineArgs, Boolean assumeDotNetFramework)\r\n   at Microsoft.FSharp.Compiler.CompileOps.ScriptPreprocessClosure.GetFullClosureOfScriptSource(CompilationThreadToken ctok, Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, String source, CodeContext codeContext, Boolean useSimpleResolution, Boolean useFsiAuxLib, LexResourceManager lexResourceManager, FSharpFunc`2 applyCommmandLineArgs, Boolean assumeDotNetFramework)\r\n   at Microsoft.FSharp.Compiler.CompileOps.LoadClosure.ComputeClosureOfSourceText(CompilationThreadToken ctok, Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, String source, CodeContext implicitDefines, Boolean useSimpleResolution, Boolean useFsiAuxLib, LexResourceManager lexResourceManager, FSharpFunc`2 applyCompilerOptions, Boolean assumeDotNetFramework)\r\n   at <StartupCode$FSharp-Compiler-Service>[email protected](ErrorScope _arg30)\r\n   at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.CancellableBuilder.Using[c,d](c resource, FSharpFunc`2 e)\r\n   at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.CancellableModule.delay@751.Invoke(CancellationToken ct)\r\n   at <StartupCode$FSharp-Compiler-Service>[email protected](CompilationThreadToken ctok)\r\n\r\nWRN: Assembly binding logging is turned OFF.\r\nTo enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1.\r\nNote: There is some performance penalty associated with assembly bind failure logging.\r\nTo turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog].\r\n)"
[20:54:43 DEBUG] REQ (005) -> {symboluse}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","Line":3,"Column":11,"Filter":""}
[20:54:43 DEBUG] RES (005) <- {symboluse} in 57 ms: Kind={"error"}
Data={"Code":1,"Message":"File 'c:\\IonideRepro\\test.fsx' not parsed","AdditionalData":{}}
[20:54:43 ERROR] Cannot execute symboluse, File 'c:\IonideRepro\test.fsx' not parsed 
[20:54:44 DEBUG] REQ (006) -> {signature}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","Line":3,"Column":11,"Filter":""}
[20:54:44 DEBUG] RES (006) <- {signature} in 8 ms: Kind={"error"}
Data={"Code":1,"Message":"File 'c:\\IonideRepro\\test.fsx' not parsed","AdditionalData":{}}
[20:54:44 ERROR] Cannot execute signature, File 'c:\IonideRepro\test.fsx' not parsed 
[20:54:50 DEBUG] REQ (007) -> {symboluse}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","Line":5,"Column":18,"Filter":""}
[20:54:50 DEBUG] RES (007) <- {symboluse} in 21 ms: Kind={"error"}
Data={"Code":1,"Message":"File 'c:\\IonideRepro\\test.fsx' not parsed","AdditionalData":{}}
[20:54:50 ERROR] Cannot execute symboluse, File 'c:\IonideRepro\test.fsx' not parsed 
[20:54:50 DEBUG] REQ (008) -> {symboluse}, File = "~\test.fsx"
Data={"FileName":"c:\\IonideRepro\\test.fsx","Line":5,"Column":18,"Filter":""}
[20:54:50 DEBUG] RES (008) <- {symboluse} in 6 ms: Kind={"error"}
Data={"Code":1,"Message":"File 'c:\\IonideRepro\\test.fsx' not parsed","AdditionalData":{}}

Any idea what can be wrong, or what else should I investigate to troubleshoot?

VSCode version: 1.19.0
Ionide-fsharp version: 3.15.5

reproduction needed workaround

Most helpful comment

PS, you can work around the issue for now by copy/pasting System.ValueTuple.dll from the F# 4.1 dir (C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0) to C:\Users{MyUser}.vscode\extensions\Ionide.ionide-fsharp-3.15.5\bin

All 15 comments

This also started to happen in earlier versions, at least 1.18.1 and 1.17.0

Same issue for me. Maybe this relates to using F# 4.1 - System.ValueTuple not found?

VSC 1.19.1, fsharp-ionide 3.15.5, win 10. All settings default. Open any fsx file (or change contents of one):

console.ts:123 [Extension Host] [IONIDE-FSAC] REQ (033) -> {parse}, File = "~\test.fsx"
Data=Object
console.ts:123 [Extension Host] last output: []
console.ts:123 [Extension Host] [IONIDE-FSAC] RES (033) <- {parse} in 49 ms: Kind={"info"}
Data=Request cancelled (exn was System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Microsoft.FSharp.Compiler.CompileOps.GetDefaultSystemValueTupleReference()
   at Microsoft.FSharp.Compiler.CompileOps.DefaultReferencesForScriptsAndOutOfProjectSources@1805.GenerateNext(IEnumerable`1& next)
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at Microsoft.FSharp.Compiler.CompileOps.BasicReferencesForScriptLoadClosure(Boolean useFsiAuxLib, Boolean assumeDotNetFramework)
   at Microsoft.FSharp.Compiler.CompileOps.ScriptPreprocessClosure.CreateScriptSourceTcConfig[a](Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, CodeContext codeContext, Boolean useSimpleResolution, Boolean useFsiAuxLib, FSharpOption`1 basicReferences, FSharpFunc`2 applyCommandLineArgs, Boolean assumeDotNetFramework)
   at Microsoft.FSharp.Compiler.CompileOps.ScriptPreprocessClosure.GetFullClosureOfScriptSource(CompilationThreadToken ctok, Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, String source, CodeContext codeContext, Boolean useSimpleResolution, Boolean useFsiAuxLib, LexResourceManager lexResourceManager, FSharpFunc`2 applyCommmandLineArgs, Boolean assumeDotNetFramework)
   at Microsoft.FSharp.Compiler.CompileOps.LoadClosure.ComputeClosureOfSourceText(CompilationThreadToken ctok, Resolver legacyReferenceResolver, String defaultFSharpBinariesDir, String filename, String source, CodeContext implicitDefines, Boolean useSimpleResolution, Boolean useFsiAuxLib, LexResourceManager lexResourceManager, FSharpFunc`2 applyCompilerOptions, Boolean assumeDotNetFramework)
   at <StartupCode$FSharp-Compiler-Service>[email protected](ErrorScope _arg30)
   at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.CancellableBuilder.Using[c,d](c resource, FSharpFunc`2 e)
   at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.CancellableModule.delay@751.Invoke(CancellationToken ct)
   at <StartupCode$FSharp-Compiler-Service>[email protected](CompilationThreadToken ctok)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
)
console.ts:123 [Extension Host] [IONIDE-FSAC] REQ (034) -> {declarations}, File = "~\test.fsx"
Data=Object
console.ts:123 [Extension Host] [IONIDE-FSAC] RES (034) <- {declarations} in 3 ms: Kind={"declarations"}
Data=Array(1)
console.ts:123 [Extension Host] [IONIDE-FSAC] REQ (035) -> {signature}, File = "~\test.fsx"
Data=Object
console.ts:123 [Extension Host] [IONIDE-FSAC] RES (035) <- {signature} in 4 ms: Kind={"error"}
Data=Object
console.ts:123 [Extension Host] [IONIDE-FSAC] Cannot execute signature, File 'c:\drive\WORK\teach17\arch\projtb\test.fsx' not parsed 
console.ts:123 [Extension Host] [IONIDE-FSAC] REQ (036) -> {signature}, File = "~\test.fsx"
Data=Object
console.ts:123 [Extension Host] [IONIDE-FSAC] RES (036) <- {signature} in 3 ms: Kind={"error"}
Data=Object
console.ts:123 [Extension Host] [IONIDE-FSAC] Cannot execute signature, File 'c:\drive\WORK\teach17\arch\projtb\test.fsx' not parsed 

The particular branch of FSAC (a29cf5b36b31c68081cd420ef0e03b30fdd6569d) seems to have taken a transitive dependency on System.ValueTuple, which is an F# 4.1 lib. FSAC currently has a toplevel dependency on FSharp.Core (nuget version 4.0.0.1), which corresponds to F# 4.0. With assembly binding redirects on, FSAC may not be able to find/bind System.ValueTuple.dll.

I tried bumping FSAC to FSharp.Core 4.2.3, and this seem to resolve the issue, although now the ionide project won't load, so it may have broken other stuff.

PS, you can work around the issue for now by copy/pasting System.ValueTuple.dll from the F# 4.1 dir (C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0) to C:\Users{MyUser}.vscode\extensions\Ionide.ionide-fsharp-3.15.5\bin

Can you please try 3.15.6?

You work fast, my friend. Please stand by....

3.15.6 gives the same error messages on my system as 3.15.5! fast work though I agree...

I'll try Horace's fix as well.

Yes, Horace your fix works for me (on 3.15.6)! Thanks!

PS I'll undo the fix if Krzysztof wants more testing...

@Krzysztof-Cieslak, No dice with 3.15.6. Maybe bumping FSharp.Core wasn't the actual solution :(

Yep, the workaround works for me too, thanks for the tip!

Maybe I'm bonkers, but when i build and run ionide 3.15.6 and launch an experimental instance, it seems to work.

Maybe I've released something wrongly...

Just to be sure, I tried pulling down the repo and building from scratch again, but dotnet restore is now failing on the .netcore build of FSAC. Might be related to the new version of FSharp.Core. I'll have to take a closer look later.

Should be fixed with 3.15.7. Props to @HoraceGonzalez

Was this page helpful?
0 / 5 - 0 ratings

Related issues

landy picture landy  路  5Comments

draganjovanovic1 picture draganjovanovic1  路  3Comments

isaacabraham picture isaacabraham  路  5Comments

vasily-kirichenko picture vasily-kirichenko  路  6Comments

isaacabraham picture isaacabraham  路  3Comments