ionide / ionide-vscode-fsharp

VS Code plugin for F# development
http://ionide.io
MIT License
865 stars 279 forks source link

.NET 6 NullReferenceException #1629

Closed Ciantic closed 2 years ago

Ciantic commented 3 years ago

Describe the bug

The .NET 6 support was closed, so I'm not sure what the issue is. With .NET 6 brand new project, Intellisense is broken, I get errors and NullReferenceException:

[Error - 14.15.18] Request textDocument/codeAction failed.
  Message: System.NullReferenceException: Object reference not set to an instance of an object.
   at FsAutoComplete.CodeFix.Run.ifDiagnosticByType@176.Invoke(Diagnostic d) in D:\a\ionide-vscode-fsharp\ionide-vscode-fsharp\paket-files\github.com\fsharp\FsAutoComplete\src\FsAutoComplete\CodeFixes.fs:line 176
   at FsAutoComplete.CodeFix.Run.runDiagnostics@166-1.Invoke(Diagnostic d) in D:\a\ionide-vscode-fsharp\ionide-vscode-fsharp\paket-files\github.com\fsharp\FsAutoComplete\src\FsAutoComplete\CodeFixes.fs:line 166
   at Microsoft.FSharp.Collections.ArrayModule.Choose[T,TResult](FSharpFunc`2 chooser, T[] array) in D:\a\_work\1\s\src\fsharp\FSharp.Core\array.fs:line 478
   at FsAutoComplete.CodeFix.Run.runDiagnostics(FSharpFunc`2 pred, FSharpFunc`2 handler, CodeActionParams codeActionParams) in D:\a\ionide-vscode-fsharp\ionide-vscode-fsharp\paket-files\github.com\fsharp\FsAutoComplete\src\FsAutoComplete\CodeFixes.fs:line 165
   at FsAutoComplete.CodeFix.Run.ifDiagnosticByType@176-1.Invoke(CodeActionParams codeActionParams) in D:\a\ionide-vscode-fsharp\ionide-vscode-fsharp\paket-files\github.com\fsharp\FsAutoComplete\src\FsAutoComplete\CodeFixes.fs:line 176
   at FsAutoComplete.Lsp.TextDocumentCodeAction@1788-1.Invoke(Unit unitVar) in D:\a\ionide-vscode-fsharp\ionide-vscode-fsharp\paket-files\github.com\fsharp\FsAutoComplete\src\FsAutoComplete\FsAutoComplete.Lsp.fs:line 1790
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 446
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
  Code: -32603 

Additionally I get error like this: No .fsproj or .fsx file references c:\Source\FSharp\testgraphql\Program.fs

Steps to reproduce

  1. Install .NET 6
  2. Clone this: https://github.com/Ciantic/bug-fsharp-with-graphql
  3. Open in VSCode

Expected behaviour

No errors, and intellisense works.

Machine info

Other

The applications compiles and runs fine in Visual Studio as well as with dotnet run.

 dotnet --list-sdks    
6.0.100 [C:\Program Files (x86)\dotnet\sdk]

dotnet --list-runtimes
Microsoft.NETCore.App 6.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
open-collective-bot[bot] commented 3 years ago

Hey @Ciantic :wave:,

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 :smile:

Ciantic commented 3 years ago

I can't reproduce this anymore, I have among other things installed .NET 5 SDK. Nuked my nuget cache etc. When I could reproduce this I only had .NET 6 SDK installed.

Feel free to close this if it's not an issue, but perhaps NRE could be catched if it makes sense, and if someone else can reproduce this.

alexzandros commented 2 years ago

I'm experiencing the same issue, since I installed .NET 6 sdk Ionide stopped working completely. Ionide Version 5.10.2

image image

Krzysztof-Cieslak commented 2 years ago

Ionide works just fine with .NET 6 - actually, it's the version we require for Ionide right now. Closing.