OmniSharp / OmniSharp/csharp-language-server-protocol
Exception "No method by the name 'initialize' is found."
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 638
- Forks
- 109
- Avg merge
- 1m
- Merged PRs (30d)
- 2
Description
When starting my languageserver from my extension I get an exception from "VS/IDE/TaskStatusCenter/RunningRegisteredTaskFailed":
StreamJsonRpc.RemoteMethodNotFoundException: No method by the name 'initialize' is found.
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__154`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.LanguageServer.Client.JsonRpcExtensionMethods.<SendMethodRequestWithTelemetryAsync>d__0`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<SendInitializeRequestAsync>d__115.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<InitializeAsync>d__110.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.TplExtensions.<WithTimeout>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<TrackTaskAsync>d__113.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.<ActivateLanguageClientAsync>d__122.MoveNext()
What does this message mean? For which class is the "initialize" method missing?
I use
- omnisharp.extensions.languageserver 0.19.9
- Visual Studio Extensibility Sdk and Visual Studio Extensibility Framework 17.10.2084
- VS2022
- Nerdbank-Streams (as suggested)
Here is my language-server-provider:
using System.Diagnostics;
using System.IO.Pipelines;
using JetBrains.Annotations;
using Microsoft.VisualStudio.Extensibility;
using Microsoft.VisualStudio.Extensibility.LanguageServer;
using Microsoft.VisualStudio.RpcContracts.LanguageServerProvider;
using Nerdbank.Streams;
using ReniLSP;
namespace Reni.LSPVSIX;
#pragma warning disable VSEXTPREVIEW_LSP
[VisualStudioContribution]
[UsedImplicitly]
public sealed class ReniLanguageServerProvider : LanguageServerProvider
{
[UsedImplicitly]
Task? ServerPipeTask;
public ReniLanguageServerProvider
(ExtensionCore container, VisualStudioExtensibility extensibilityObject, TraceSource traceSource)
: base(container, extensibilityObject) { }
public override LanguageServerProviderConfiguration LanguageServerProviderConfiguration =>
new("Reni Language Server",
new[]
{
DocumentFilter.FromDocumentType(Constants.LanguageName),
});
// Activate the language server and return a duplex pipe that communicates with the server.
public override Task<IDuplexPipe?> CreateServerConnectionAsync(CancellationToken token)
{
var (pipeToServer, pipeToVS) = FullDuplexStream.CreatePair();
ServerPipeTask = Task.Run(
() => MainContainer.RunServer(pipeToVS.UsePipeReader(), pipeToServer.UsePipeWriter())
, token
);
return Task.FromResult<IDuplexPipe?>(new DuplexPipe(pipeToServer.UsePipeReader(), pipeToVS.UsePipeWriter()));
}
protected override void Dispose(bool isDisposing)
{
if(isDisposing)
ServerPipeTask?.Dispose();
base.Dispose(isDisposing);
}
public override Task OnServerInitializationResultAsync
(
ServerInitializationResult startState, LanguageServerInitializationFailureInfo? initializationFailureInfo
, CancellationToken cancellationToken
) =>
// Method called when server activation was completed successfully or failed, denoted by "startState".
Task.CompletedTask;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ReniLanguageServerProvider.CreateServerConnectionAsync and trace the MainContainer.RunServer call, using the reported OmniSharp and Visual Studio Extensibility versions as constraints. Compare the server connection with the initialization request that Visual Studio sends. Done means explaining which side lacks the initialize method and identifying the compatible configuration or integration change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100