csharp-ls: could not OpenProjectAsync
See original GitHub issueI use neovim with csharp-ls and it suddenly stopped working. I really don’t understand why.
Every time I startup the lsp I get an error on startup.
LSP[csharp_ls][Info] csharp-ls: initializing, csharp-ls version 0.4.0.0; options are: {
"logLevel": 4
}
LSP[csharp_ls][Info] csharp-ls: csharp-ls is released under MIT license and is not affiliated with Microsoft Corp.; see https://github.com/razzmatazz/csharp-language-server
LSP[csharp_ls][Log] csharp-ls: attempting to find and load solution based on cwd: "/home/nikolai/repos/astar_maze"..
LSP[csharp_ls][Log] csharp-ls: looking for .csproj/fsproj files on /home/nikolai/repos/astar_maze..
LSP[csharp_ls][Log] csharp-ls: 0 solution(s) found: []
LSP[csharp_ls][Log] csharp-ls: no or multiple .sln files found on /home/nikolai/repos/astar_maze
LSP[csharp_ls][Log] csharp-ls: loading proj file /home/nikolai/repos/astar_maze/AStarMaze.csproj..
LSP[csharp_ls][Log] csharp-ls: could not OpenProjectAsync('/home/nikolai/repos/astar_maze/AStarMaze.csproj'): System.AggregateException: One or more errors occurred. (Could not load file or assembly 'System.Conf
iguration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621))
---> System.IO.FileLoadException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specifi
c file. (0x80131621)
File name: 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
---> System.IO.FileLoadException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.Build.Locator.MSBuildLocator.<>c__DisplayClass15_0.<RegisterMSBuildPath>g__TryLoadAssembly|3(AssemblyName assemblyName)
at Microsoft.Build.Locator.MSBuildLocator.<>c__DisplayClass15_0.<RegisterMSBuildPath>b__2(AssemblyLoadContext _, AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.Build.Evaluation.ToolsetReader.ReadAllToolsets(Dictionary`2 toolsets, ToolsetConfigurationReader configurationReader, PropertyDictionary`1 environmentProperties, PropertyDictionary`1 globalProper
ties, ToolsetDefinitionLocations locations)
at Microsoft.Build.Evaluation.ProjectCollection.InitializeToolsetCollection(ToolsetConfigurationReader configReader)
at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary`2 globalProperties, IEnumerable`1 loggers, IEnumerable`1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCo
unt, Boolean onlyLogCriticalEvents, Boolean loadProjectsReadOnly, Boolean useAsynchronousLogging)
at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary`2 globalProperties)
at Microsoft.CodeAnalysis.MSBuild.Build.ProjectBuildManager.StartBatchBuild(IDictionary`2 globalProperties)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadProjectInfoAsync(String projectFilePath, ProjectMap projectMap, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenProjectAsync(String projectFilePath, ILogger msbuildLogger, IProgress`1 progress, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
LSP[csharp_ls][Log] csharp-ls: OK, 1 project files loaded
Non of the lsp commands work
I found https://github.com/emacs-lsp/lsp-mode/issues/3198 and https://github.com/razzmatazz/csharp-language-server/issues/3
But I feel the issue should be fixed after those issues
I am on the latest version of csharp-ls
I am on the correct version of dotnet (6) Like I said it suddenly stopped working (I probably did a sudo apt upgrade
)
I feel like I am missing something obvious but I cannot seem to find the issue here
Issue Analytics
- State:
- Created a year ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Program wont run, no errors, when calling async task
I'm new to C# programming, and am learning as I go. I'm working on a program to test whether a computer can connect...
Read more >Compiler Error CS4009
Update the C# language version used by the project to 7.1 or higher. If you use C# 7.0 or lower, remove the async...
Read more >async - C# Reference
If the method that the async keyword modifies doesn't contain an await expression or statement, the method executes synchronously. A compiler ...
Read more >Using Async, Await, and Task to keep the WinForms UI ...
That doesn't mean every project required C# exclusively, ... I'm going to start a series of posts that explore how we can make...
Read more >Understanding Async, Avoiding Deadlocks in C# | by Eke ...
The method you can use here is stress testing, launch many threads in parallel and see if the application survives. However this might...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have released a new version on nuget which should fix this issue:
I compiled from source again and it seems to work fine.
Might I suggest a
build from source
section in the README I used:dotnet build
, but with that you need all the dll’sFor one package I used:
dotnet publish -r linux-x64 -p:PublishSingleFile=true -p:UseAppHost=true --self-contained false
This project works really good as an LSP for me. For work we have a huge project with the whole range of Microsoft Targets, From NET 5.0 to .NET standard 2.0 to windows only .NET Framework 4.6.1. Almost all LSP actions across projects work and inside a single file everything always works in Linux with neovim.
Thanks again for the help 😄