Non-fatal exception
I keep getting this exception in message buffer when scrolling/navigating in 0.5.5:
LSP :: Error from the Language Server: System.AggregateException: One or more errors occurred. (Service of type 'Microsoft.CodeAnalysis.Options.ILegacyGlobalOptionsWorkspaceService' is required to accomplish the task but is not available from the workspace.)
---> System.InvalidOperationException: Service of type 'Microsoft.CodeAnalysis.Options.ILegacyGlobalOptionsWorkspaceService' is required to accomplish the task but is not available from the workspace.
at Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetRequiredService[TWorkspaceService]()
at Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.CreateCodeActionWithDialogAsync(Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray`1 members, CleanCodeGenerationOptionsProvider fallbackOptions, Boolean generateEquals, Boolean generateGetHashCode, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.CreateActionsAsync(Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray`1 selectedMembers, CleanCodeGenerationOptionsProvider fallbackOptions, Boolean hasEquals, Boolean hasGetHashCode, Boolean withDialog, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.HandleNonSelectionAsync(CodeRefactoringContext context, CleanCodeGenerationOptionsProvider fallbackOptions)
at Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.ComputeRefactoringsAsync(CodeRefactoringContext context)
--- End of inner exception stack trace --- (Internal Error)
It doesn't crash or anything. But it is kinda distracting.
Just noticed this myself. There is one commit where I made the exception not block other refactoring from yesterday.
But I need to fix dependency injection for Roslyn code better. This error seems to have started appearing with the update to the latest Roslyn libs.
warnings should be fixed as of https://github.com/razzmatazz/csharp-language-server/commit/bbe04d15c18f41f3c9a56da42fbc5a33209bf0dd (a new version has not been released yet)
I have released a new version on nuget which should fix this issue:
- https://www.nuget.org/packages/csharp-ls/0.5.6