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

F# server is crashing when the project is loaded #1787

Closed
JohnnyFasching opened this issue Sep 29, 2022 · 9 comments · Fixed by ionide/FsAutoComplete#1018
Closed

F# server is crashing when the project is loaded #1787

JohnnyFasching opened this issue Sep 29, 2022 · 9 comments · Fixed by ionide/FsAutoComplete#1018

Comments

@JohnnyFasching
Copy link

Describe the bug

F# server is crashing a soon a solution is loaded

System.AggregateException: One or more errors occurred. (Required property 'source' not found in JSON. Path 'context.diagnostics[0]'.)
 ---> Newtonsoft.Json.JsonSerializationException: Required property 'source' not found in JSON. Path 'context.diagnostics[0]'.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EndProcessProperty(Object newObject, JsonReader reader, JsonObjectContract contract, Int32 initialDepth, JsonProperty property, PropertyPresence presence, Boolean setDefaultValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at StreamJsonRpc.JsonMessageFormatter.JsonRpcRequest.TryGetTypedArguments(ReadOnlySpan`1 parameters, Span`1 typedArguments)
   at StreamJsonRpc.TargetMethod.TryGetArguments(JsonRpcRequest request, MethodSignature method, Span`1 arguments)
   at StreamJsonRpc.TargetMethod..ctor(JsonRpcRequest request, List`1 candidateMethodTargets, SynchronizationContext fallbackSynchronizationContext)
   at StreamJsonRpc.Reflection.RpcTargetInfo.TryGetTargetMethod(JsonRpcRequest request, TargetMethod& targetMethod)
   at StreamJsonRpc.JsonRpc.DispatchIncomingRequestAsync(JsonRpcRequest request)
   at StreamJsonRpc.JsonRpc.DispatchIncomingRequestAsync(JsonRpcRequest request)
   at StreamJsonRpc.JsonRpc.HandleRpcAsync(JsonRpcMessage rpc)
   --- End of inner exception stack trace ---
   at Ionide.LanguageServerProtocol.Server.startWithSetup[client](FSharpFunc`2 setupRequestHandlings, Stream input, Stream output, FSharpFunc`2 clientCreator, FSharpFunc`2 customizeRpc) in /_//src/LanguageServerProtocol.fs:line 179
   at Ionide.LanguageServerProtocol.Server.start@268-2.Invoke(FSharpFunc`2 customizeRpc) in /_//src/LanguageServerProtocol.fs:line 268
   at FsAutoComplete.Lsp.startCore(ToolsPath toolsPath, DirectoryInfo stateStorageDir, FSharpFunc`2 workspaceLoaderFactory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/FsAutoComplete.Lsp.fs:line 2950
   at FsAutoComplete.Lsp.start(ToolsPath toolsPath, DirectoryInfo stateStorageDir, FSharpFunc`2 workspaceLoaderFactory) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/FsAutoComplete.Lsp.fs:line 2962
[Error - 10:23:51] The F# server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. 

Machine info

  • OS: Windows 11
  • .NET SDK version: 6.0.401
  • Ionide version: v7.2.1
@rzlink
Copy link

rzlink commented Sep 30, 2022

I got the same issue.

@JohnnyFasching
Copy link
Author

@rzlink Is the code highlighting and auto complete working for you? In my case I can't work with VS Code because none of those are working.

@rzlink
Copy link

rzlink commented Sep 30, 2022

@JohnnyFasching code highlighting works for me, but auto complete not working.

@baronfel
Copy link
Contributor

Really interesting report - can you all set the fsharp.trace.server property to verbose and reload the app? that will turn on LSP-level logging of the protocol API calls - what I'm really interested in in which call is throwing unsafely, which I can't get from the stack trace because it's an error during model binding that the LSP library is doing.

@rzlink
Copy link

rzlink commented Sep 30, 2022

I also get output from F# language server
starting
Logging started
./logs/debugLog-9-30_11;10-53s--.log
logger created
[11:10:53 INF] info log
[11:10:53 WRN] warn log
[11:10:53 ERR] erroor log
fist log should have happened
[11:10:53 INF] created new Project Manager
[11:10:53 WRN] Couldn't find FSharp.Core.dll in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.9
[11:10:53 WRN] Couldn't find System.ComponentModel.Composition.dll in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.9
[11:10:53 WRN] Couldn't find System.Runtime.InteropServices.WindowsRuntime.dll in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.9
[11:10:54 INF] Add workspace root d:\github\dummy
[11:10:54 INF] returning capabilities
[11:10:54 INF] Running inititialization

@rzlink
Copy link

rzlink commented Sep 30, 2022

@baronfel here is the log.
fsharp_lsp_crashing.txt

@baronfel
Copy link
Contributor

Thanks @rzlink - it looks like we regressed some of the type definitions for the LSP library - I'll work on getting those updated and rolled out through FSAC and Ionide.

@rzlink
Copy link

rzlink commented Sep 30, 2022

Thanks @baronfel for the quick fix.

One question, do you know the warning which dlls not found?
I fount the missing dlls (FSharp.Core.dll, System.ComponentModel.Composition.dll) are under C:\Program Files\dotnet\sdk\6.0.401\FSharp, why it search folder "C:\Program Files\dotnet\shared\Microsoft.NETCore.App"?

@baronfel
Copy link
Contributor

The DLLs in the FSharp folder are the runtime dependencies for the F# compiler, they're not intended to be used by other F# applications directly.

The DLLs in the FrameworkReferences folders like the second path are meant to be those runtime dependencies. These directories are usually located by the MSBuild logic that is part of building your projects, and the error you're alluding to is because we're having problems replicating that logic in the ionide/proj-info repo for every possible combinations of .NET SDKs. We're working on it, though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants