Closed WillEhrendreich closed 11 months ago
it also seems to hang for quite a while on opening a project regardless of any diagnostics.. not sure if it's a "same issue, different symptom" thing, or if it's a separate issue entirely, but it's only starting doing this on newer versions of FSAC
Based on Required property 'range' not found in JSON. Path 'context.diagnostics[0]'.)\r\n
which is probably coming from this structure:
Which specifies a range
that can't be null. Based on that, I'd think whatever language client your using for code actions has a bug.
Interesting.. ok. the only thing I can think of is I recently installed Clear-Action by @luckasRanarison and It's possible this adds something that could trip FSAC up? I'll try it without for a bit and see if I still get issues..
It might also be useful to dump the raw LSP requests and responses to verify the shape of the diagnostics involved.
that does sound useful.. how should I do that? is there a way to dump only diagnostic and code action related logs to a file? I seem to remember seeing something like that.
That's going to vary based on the LSP client - for example, in VSCode you can set "FSharp.trace.server": "verbose"
and VSCode will log the protocol-level messages.
Sorry for the trouble. This issue seems to be related to my plugin and this PR https://github.com/luckasRanarison/clear-action.nvim/pull/13. We've switched to vim.diagostic.get()
to get the diagnostics but I just realized that it doesn't provide range for diagnostics, which explains the exception. I'll try to fix it.
That being said, we shouldn't crash. Probably need a fix in https://github.com/ionide/LanguageServerProtocol to return a parseError if we get a JsonSerializationException
.
But according to the specs range
should always be provided, so it should be handled on the client side.
@luckasRanarison agreed, but the way that the server can cleanly communicate that to the client is by the parse error - right now the entire FSAC process crashes. I think this is pretty bad behavior on our part :)
Version
0.66.1
Dotnet Info
.NET SDK: Version: 7.0.401 Commit: eb26aacfec
Runtime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.401\
Host: Version: 8.0.0-rc.2.23479.6 Architecture: x64 Commit: 0b25e38ad3
.NET SDKs installed: 7.0.203 [C:\Program Files\dotnet\sdk] 7.0.401 [C:\Program Files\dotnet\sdk] 8.0.100-rc.2.23502.2 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-rc.2.23480.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-rc.2.23479.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0-rc.2.23479.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: C:\Users\will.ehrendreich\source\repos\Fabload\global.json
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
Steps to reproduce
I wish I had better steps.. but I don't understand what's causing crashing.
it seems like there might be something with diagnostics? I'm not sure if it's required but I don't see why it would affect it, as there shouldn't be anything too diagnostic specific about it, but I use my version of Ionide-nvim
this will sound dumb, but.. here we go..
1 open up a project with neovim with diagnostics that need fixing.. 2 change something.. 3 crash. 4 get long json rpc error message.
5 cry.. a little. 6 complain to the nice smart people online who have any idea of what's going on 7 wish you had better steps than this pile of garbage.
Details
I'm not sure why it happens, I just know it keeps crashing after I updated fsautocomplete to the latest version of 0.66.1.
I can't remember the last version that worked.. I think it was 63 or 64??
I do know it was working with the same exact project before I upgraded though..
Logs
[ERROR][2023-10-26 19:53:38] .../vim/lsp/rpc.lua:734 "rpc" "C:\.local\share\nvim-data\mason\bin\fsautocomplete.CMD" "stderr" "[19:53:38.194 ERR] [Startup] Start - LSP mode crashed\r\nSystem.AggregateException: One or more errors occurred. (Required property 'range' not found in JSON. Path 'context.diagnostics[0]'.)\r\n ---> Newtonsoft.Json.JsonSerializationException: Required property 'range' not found in JSON. Path 'context.diagnostics[0]'.\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EndProcessProperty(Object newObject, JsonReader reader, JsonObjectContract contract, Int32 initialDepth, JsonProperty property, PropertyPresence presence, Boolean setDefaultValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor
1 creator, String id)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)\r\n at Newtonsoft.Json.Serialization.JsonSerializerIntern" [ERROR][2023-10-26 19:53:38] .../vim/lsp/rpc.lua:734 "rpc" "C:\\.local\\share\\nvim-data\\mason\\bin\\fsautocomplete.CMD" "stderr" "alReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor
1 creator, String id)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor1 creator, String id)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)\r\n at StreamJsonRpc.JsonMessageFormatter.JsonRpcRequest.TryGetTypedArguments(ReadOnlySpan
1 parameters, Span1 typedArguments)\r\n at StreamJsonRpc.TargetMethod.TryGetArguments(JsonRpcRequest request, MethodSignature method, Span
1 arguments)\r\n at StreamJsonRpc.TargetMethod..ctor(JsonRpcRequest request, List1 candidateMethodTargets, SynchronizationContext fallbackSynchronizationContext)\r\n at StreamJsonRpc.Reflection.RpcTargetInfo.TryGetTargetMethod(JsonRpcRequest request, TargetMethod& targetMethod)\r\n at StreamJsonRpc.JsonRpc.DispatchIncomingRequestAsync(JsonRpcRequest request)\r\n at StreamJsonRpc.JsonRpc.DispatchIncomingRequestAsync(JsonRpcRequest request)\r\n at StreamJsonRpc.JsonRpc.HandleRpcAsync(JsonRpcMessage rpc)\r\n --- End of inner exception stack trace ---\r\n at Ionide.LanguageServerProtocol.Server.startWithSetup[client](FSharpFunc
2 setupRequestHandlings, Stream input, Stream output, FSharpFunc2 clientCreator, FSharpFunc
2 customizeRpc) in ///src/LanguageServerProtocol.fs:line 183\r\n at Ionide.LanguageServerProtocol.Server.start@286-2.Invoke(FSharpFunc`2 customizeRpc) in ///src/LanguageServerProtocol.fs:line 286\r\n at FsAutoComplete.Lsp.AdaptiveFSharpLspServerModule.startCore[a,a](a toolsPath, FSharpFunc2 workspaceLoaderFactory, ISourceTextFactory sourceTextFactory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs:line 5093\r\n at FsAutoComplete.Lsp.AdaptiveFSharpLspServerModule.start(FSharpFunc
2 startCore) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs:line 5132\Checklist