Ionide-vscode-fsharp: New F# project will build and run, but VSCode shows red squigglies and no intellisense for non-system namespace references

Created on 20 Jun 2017  Â·  7Comments  Â·  Source: ionide/ionide-vscode-fsharp

I just set up VSCode on Windows 10 (Creator's Update release) and added Ionide-fsharp, -Packet and -FAKE. Created new console app from template and then added global and local project reference to Newtonsoft.Json using Packet. I immediately get a red squiggle under the namespace in "open Newtonsoft.Json", with a "The namespace or module 'Newtonsoft.Json' is not defined on hover. Project will build and run perfectly though, so looks to be an extension issue. When I look at the Developer Console I do see this... [Extension Host] [IONIDE-FSAC] RES (007) <- {completion} ERROR in 38130 ms: {SyntaxError: Unexpected token u in JSON at position 0}, Data=%O. Running F# 4.1 if that is important.

Most helpful comment

@Krzysztof-Cieslak I've been using Visual F# 4.1 since it came out, but didn't notice this behavior in Ionide until recently (although I can't pinpoint a date). Did something change? Do you mind sharing why the readme specifies those particular versions of the prerequisites?

All 7 comments

Install all requirements specified in project readme.

I did that. The only variation was installing F# 4.1.

Sent from my Windows 10 phone

From: Krzysztof Cieślaknotifications@github.com
Sent: June 20, 2017 1:36 AM
To: ionide/ionide-vscode-fsharpionide-vscode-fsharp@noreply.github.com
Cc: Gregor Noriskingregornoriskin@gmail.com; Authorauthor@noreply.github.com
Subject: Re: [ionide/ionide-vscode-fsharp] New F# project will build and run, but VSCode shows red squigglies and no intellisense for non-system namespace references (#453)

Install all requirements specified in project readme.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/ionide/ionide-vscode-fsharp/issues/453#issuecomment-309684136, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABz70iloQOXhOZ29BTZV_Yw94Vpm_u1Hks5sF4RqgaJpZM4N--4C.

I am also experiencing this problem. I left a comment in #443 to this effect, but this one perhaps is more directly on-point.

I, too, have installed all the prerequisites, albeit perhaps at different versions. I have installed Visual Studio 2017 (which includes the build tools), and Visual F# 4.1.

Here is the debug output of the F# Language Service:

[13:19:51 DEBUG] REQ (001) -> {project}, File = "~\src\BitThicket.NotificationHelperSvc\BitThicket.NotificationHelperSvc.fsproj"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\BitThicket.NotificationHelperSvc.fsproj"}
[13:19:52 DEBUG] RES (001) <- {project} in 1101 ms: Kind={"error"}
Data={"Code":1,"Message":"MSBuild failed with exitCode 1 Working Directory: 'd:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc' Exe Path: 'dotnet' Args: 'msbuild d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\BitThicket.NotificationHelperSvc.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpCD07.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpCD17.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpCD18.tmp.GetProperties.txt /nologo /verbosity:quiet'","AdditionalData":{}}
[13:19:52 ERROR] Project loading failed, MSBuild failed with exitCode 1 Working Directory: 'd:\Users\ben\proj\bt\NotificationHelper\src\BitThicket.NotificationHelperSvc' Exe Path: 'dotnet' Args: 'msbuild d:\Users\ben\proj\bt\NotificationHelper\src\BitThicket.NotificationHelperSvc\BitThicket.NotificationHelperSvc.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=C:\Users\ben\AppData\Local\Temp\tmpCD07.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=C:\Users\ben\AppData\Local\Temp\tmpCD17.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=C:\Users\ben\AppData\Local\Temp\tmpCD18.tmp.GetProperties.txt /nologo /verbosity:quiet' 
[13:19:52 DEBUG] REQ (002) -> {parse}, File = "~\src\BitThicket.NotificationHelperSvc\Program.fs"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","IsAsync":true,"Lines":["open System.Reflection\r","[<assembly:AssemblyTitle(\"Notification Helper Service\")>]\r","()\r","\r","open System\r","open Topshelf\r","open Time\r","\r","[<EntryPoint>]\r","let main argv =\r","    printfn \"Hello World from F#!\"\r","    0 // return an integer exit code\r",""],"Version":1}
[13:19:55 DEBUG] RES (002) <- {parse} in 3114 ms: Kind={"errors"}
Data={"File":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","Errors":[{"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","StartLine":6,"EndLine":6,"StartColumn":6,"EndColumn":14,"Severity":"Error","Message":"The namespace or module 'Topshelf' is not defined.","Subcategory":"typecheck"},{"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","StartLine":7,"EndLine":7,"StartColumn":6,"EndColumn":10,"Severity":"Error","Message":"The namespace or module 'Time' is not defined. Maybe you want one of the following:\r\n   Timers","Subcategory":"typecheck"}]}
[13:19:56 DEBUG] REQ (003) -> {project}, File = "~\src\BitThicket.NotificationHelperSvc\BitThicket.NotificationHelperSvc.fsproj"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\BitThicket.NotificationHelperSvc.fsproj"}
[13:19:56 DEBUG] REQ (004) -> {lint}, File = "~\src\BitThicket.NotificationHelperSvc\Program.fs"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs"}
[13:19:57 DEBUG] REQ (005) -> {declarations}, File = "~\src\BitThicket.NotificationHelperSvc\Program.fs"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","Version":1}
[13:19:57 DEBUG] RES (005) <- {declarations} in 55 ms: Kind={"declarations"}
Data=[{"Declaration":{"UniqueName":"Program_1_of_1","Name":"Program","Glyph":"Module","GlyphChar":"N","IsTopLevel":true,"Range":{"StartColumn":1,"StartLine":1,"EndColumn":1,"EndLine":13},"BodyRange":{"StartColumn":1,"StartLine":1,"EndColumn":6,"EndLine":12},"File":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","EnclosingEntity":"M","IsAbstract":false},"Nested":[{"UniqueName":"Program_1_of_1","Name":"main","Glyph":"Field","GlyphChar":"F","IsTopLevel":false,"Range":{"StartColumn":5,"StartLine":10,"EndColumn":6,"EndLine":12},"BodyRange":{"StartColumn":5,"StartLine":10,"EndColumn":6,"EndLine":12},"File":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","EnclosingEntity":"M","IsAbstract":false}]}]
[13:19:57 DEBUG] RES (004) <- {lint} in 403 ms: Kind={"lint"}
Data=[]
[13:19:57 DEBUG] RES (003) <- {project} in 804 ms: Kind={"error"}
Data={"Code":1,"Message":"MSBuild failed with exitCode 1 Working Directory: 'd:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc' Exe Path: 'dotnet' Args: 'msbuild d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\BitThicket.NotificationHelperSvc.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpE209.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpE20A.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpE20B.tmp.GetProperties.txt /nologo /verbosity:quiet'","AdditionalData":{}}
[13:19:57 ERROR] Project loading failed, MSBuild failed with exitCode 1 Working Directory: 'd:\Users\ben\proj\bt\NotificationHelper\src\BitThicket.NotificationHelperSvc' Exe Path: 'dotnet' Args: 'msbuild d:\Users\ben\proj\bt\NotificationHelper\src\BitThicket.NotificationHelperSvc\BitThicket.NotificationHelperSvc.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=C:\Users\ben\AppData\Local\Temp\tmpE209.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=C:\Users\ben\AppData\Local\Temp\tmpE20A.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=C:\Users\ben\AppData\Local\Temp\tmpE20B.tmp.GetProperties.txt /nologo /verbosity:quiet' 
[13:19:58 DEBUG] REQ (006) -> {signature}, File = "~\src\BitThicket.NotificationHelperSvc\Program.fs"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","Line":10,"Column":5,"Filter":""}
[13:19:58 DEBUG] RES (006) <- {signature} in 254 ms: Kind={"typesig"}
Data="val main : argv:string [] -> int"
[13:20:08 DEBUG] REQ (007) -> {project}, File = "~\src\BitThicket.NotificationHelperSvc\BitThicket.NotificationHelperSvc.fsproj"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\BitThicket.NotificationHelperSvc.fsproj"}
[13:20:09 DEBUG] RES (007) <- {project} in 841 ms: Kind={"error"}
Data={"Code":1,"Message":"MSBuild failed with exitCode 1 Working Directory: 'd:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc' Exe Path: 'dotnet' Args: 'msbuild d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\BitThicket.NotificationHelperSvc.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpFD2.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpFD3.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=C:\\Users\\ben\\AppData\\Local\\Temp\\tmpFD4.tmp.GetProperties.txt /nologo /verbosity:quiet'","AdditionalData":{}}
[13:20:09 ERROR] Project loading failed, MSBuild failed with exitCode 1 Working Directory: 'd:\Users\ben\proj\bt\NotificationHelper\src\BitThicket.NotificationHelperSvc' Exe Path: 'dotnet' Args: 'msbuild d:\Users\ben\proj\bt\NotificationHelper\src\BitThicket.NotificationHelperSvc\BitThicket.NotificationHelperSvc.fsproj /p:SkipCompilerExecution=true /p:ProvideCommandLineArgs=true /p:CopyBuildOutputToOutputDirectory=false /p:UseCommonOutputDirectory=true /t:_Inspect_FscArgs /p:_Inspect_FscArgs_OutFile=C:\Users\ben\AppData\Local\Temp\tmpFD2.tmp.FscArgs.txt /p:DesignTimeBuild=true /t:_Inspect_GetResolvedProjectReferences /p:_Inspect_GetResolvedProjectReferences_OutFile=C:\Users\ben\AppData\Local\Temp\tmpFD3.tmp.GetResolvedProjectReferences.txt /t:_Inspect_GetProperties /p:_Inspect_GetProperties_OutFile=C:\Users\ben\AppData\Local\Temp\tmpFD4.tmp.GetProperties.txt /nologo /verbosity:quiet' 
[13:20:09 DEBUG] REQ (008) -> {parse}, File = "~\src\BitThicket.NotificationHelperSvc\Program.fs"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","IsAsync":true,"Lines":["open System.Reflection\r","[<assembly:AssemblyTitle(\"Notification Helper Service\")>]\r","()\r","\r","open System\r","open Topshelf\r","open Time\r","\r","[<EntryPoint>]\r","let main argv =\r","    printfn \"Hello World from F#!\"\r","    0 // return an integer exit code\r",""],"Version":1}
[13:20:09 DEBUG] RES (008) <- {parse} in 38 ms: Kind={"errors"}
Data={"File":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","Errors":[{"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","StartLine":6,"EndLine":6,"StartColumn":6,"EndColumn":14,"Severity":"Error","Message":"The namespace or module 'Topshelf' is not defined.","Subcategory":"typecheck"},{"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs","StartLine":7,"EndLine":7,"StartColumn":6,"EndColumn":10,"Severity":"Error","Message":"The namespace or module 'Time' is not defined. Maybe you want one of the following:\r\n   Timers","Subcategory":"typecheck"}]}
[13:20:10 DEBUG] REQ (009) -> {lint}, File = "~\src\BitThicket.NotificationHelperSvc\Program.fs"
Data={"FileName":"d:\\Users\\ben\\proj\\bt\\NotificationHelper\\src\\BitThicket.NotificationHelperSvc\\Program.fs"}
[13:20:10 DEBUG] RES (009) <- {lint} in 9 ms: Kind={"lint"}
Data=[]

I'm pretty sure there is a reason why readme specifies versions of requirements to be installed.

Hello,

Same problem here.
I have installed all the dependencies as specified in the README with the corresponding version.

When I enable logging, I can see an error due to missing assembly (Microsoft.Build.Utilities.v12.0):

[19:19:58 DEBUG] RES (001) <- {project} in 589 ms: Kind={"project"}
Data={"Project":"c:\\Users\\bertrand\\Desktop\\Workspace\\ElmAppliedToWPF\\src\\Elm\\Elm.fsproj","Files":[],"Output":"null","References":["C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\FSharp\\.NETFramework\\v4.0\\4.4.0.0\\FSharp.Core.dll"],"Logs":{"c:\\Users\\bertrand\\Desktop\\Workspace\\ElmAppliedToWPF\\src\\Elm\\Elm.fsproj":"System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.\r\nFile name: 'Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'\r\n   at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.FSharpProjectFileInfo..ctor(String fsprojFileName, FSharpOption`1 properties, FSharpOption`1 enableLogging)\r\n   at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.getOptions@387(Boolean enableLogging, FSharpList`1 properties, String file)\r\n   at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.getOptions(String file, Boolean enableLogging, FSharpList`1 properties)\r\n   at Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.crackOpen(String[] argv)\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"}}

I did a git clean -df -dx to remove all my dependencies and run paket restore to get dependencies back.

After that everything worked perfectly.

@Krzysztof-Cieslak I've been using Visual F# 4.1 since it came out, but didn't notice this behavior in Ionide until recently (although I can't pinpoint a date). Did something change? Do you mind sharing why the readme specifies those particular versions of the prerequisites?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sivabudh picture sivabudh  Â·  3Comments

draganjovanovic1 picture draganjovanovic1  Â·  3Comments

MikaelUmaN picture MikaelUmaN  Â·  5Comments

dustinmoris picture dustinmoris  Â·  3Comments

MangelMaxime picture MangelMaxime  Â·  4Comments