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

Omnisharp dies when connecting to LiveShare session #3910

Closed
baronmog opened this issue Jul 13, 2020 · 8 comments · Fixed by #4038
Closed

Omnisharp dies when connecting to LiveShare session #3910

baronmog opened this issue Jul 13, 2020 · 8 comments · Fixed by #4038

Comments

@baronmog
Copy link

Environment data

.NET Core SDK (reflecting any global.json):
Version: 3.1.301
Commit: 7feb845744

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.301/

Host (useful for support):
Version: 3.1.5
Commit: 65cd789777

.NET Core SDKs installed:
3.1.101 [/usr/local/share/dotnet/sdk]
3.1.200 [/usr/local/share/dotnet/sdk]
3.1.301 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

VS Code version: 1.47.0

C# Extension version: 1.22.1

OmniSharp log

[Client - 12:35:24 PM] Razor language server path: /Users/nromer/.vscode/extensions/ms-dotnettools.csharp-1.22.1/.razor/rzls
[Client - 12:35:33 PM] Starting Razor Language Server...
[Client - 12:35:33 PM] Server started, waiting for client to be ready...
[Info - 12:35:33 PM] Finding descriptor for initialize
[Info - 12:35:33 PM] Starting: Routing Request (0) initialize
[Info - 12:35:33 PM] Converting params for Request (0) initialize to OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams
[Error - 12:35:33 PM] Failed to handle notification initialize - System.ArgumentNullException: Value cannot be null. (Parameter 'workspaceDirectory')
at Microsoft.AspNetCore.Razor.LanguageServer.ProjectConfigurationFileChangeDetector.StartAsync(String workspaceDirectory, CancellationToken cancellationToken) in //src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs:line 50
at Microsoft.AspNetCore.Razor.LanguageServer.RazorFileChangeDetectorManager.InitializedAsync(ILanguageServer languageServer) in /
/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorFileChangeDetectorManager.cs:line 42
at Microsoft.AspNetCore.Razor.LanguageServer.RazorLanguageServer.<>c__DisplayClass1_0.<b__3>d.MoveNext() in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs:line 53
--- End of stack trace from previous location ---
at OmniSharp.Extensions.LanguageServer.Server.LanguageServer.MediatR.IRequestHandler<OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams,OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult>.Handle(InitializeParams request, CancellationToken token)
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)
at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)
at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase1.RouteRequest(TDescriptor descriptor, Request request, CancellationToken token) [Info - 12:35:33 PM] Finished: Routing Request (0) initialize in 63ms [Error - 12:35:33 PM] Server initialization failed. Message: Internal Error - System.ArgumentNullException: Value cannot be null. (Parameter 'workspaceDirectory') at Microsoft.AspNetCore.Razor.LanguageServer.ProjectConfigurationFileChangeDetector.StartAsync(String workspaceDirectory, CancellationToken cancellationToken) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs:line 50 at Microsoft.AspNetCore.Razor.LanguageServer.RazorFileChangeDetectorManager.InitializedAsync(ILanguageServer languageServer) in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorFileChangeDetectorManager.cs:line 42 at Microsoft.AspNetCore.Razor.LanguageServer.RazorLanguageServer.<>c__DisplayClass1_0.<<CreateAsync>b__3>d.MoveNext() in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs:line 53 --- End of stack trace from previous location --- at OmniSharp.Extensions.LanguageServer.Server.LanguageServer.MediatR.IRequestHandler<OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams,OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult>.Handle(InitializeParams request, CancellationToken token) at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next) at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next) at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next) at OmniSharp.Extensions.JsonRpc.RequestRouterBase1.RouteRequest(TDescriptor descriptor, Request request, CancellationToken token)
Code: -32602
[Info - 12:35:33 PM] Finding descriptor for shutdown
[Info - 12:35:33 PM] Starting: Routing Request (1) shutdown
[Info - 12:35:33 PM] Converting params for Request (1) shutdown to OmniSharp.Extensions.JsonRpc.EmptyRequest
[Info - 12:35:33 PM] Result was System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[MediatR.Unit, MediatR, Version=7.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2],[MediatR.Pipeline.RequestPreProcessorBehavior`2+d__2[[OmniSharp.Extensions.JsonRpc.EmptyRequest, OmniSharp.Extensions.JsonRpc, Version=0.14.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[MediatR.Unit, MediatR, Version=7.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]], MediatR, Version=7.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]]
[Info - 12:35:33 PM] Response value was (null)
[Info - 12:35:33 PM] Finished: Routing Request (1) shutdown in 13ms

Steps to reproduce

Connect to a LiveShare session hosted on VS 2019 (Windows).

Expected behavior

OmniSharp shouldn't die.

Actual behavior

Omnisharp dies immediately. The LiveShare session still works (I can view and edit code in it), but OmniSharp doesn't.

@cartermp
Copy link

cc @NTaylorMullen looks like the stack trace is from the razor language server

@NTaylorMullen
Copy link
Contributor

Hmm @baronmog are you saying that you get no C# experience even in C# files? Or is it just the Razor experience that dies?

@n3rd253
Copy link

n3rd253 commented Sep 3, 2020

@NTaylorMullen Razor and C# alike for me.

Razor.VSCode version 6.0.0-alpha.1.20418.9

Razor's trace level is currently set to 'Off'

  • To change Razor's trace level set 'razor.trace' to 'Off', 'Messages' or 'Verbose' and then restart VSCode.
  • To report issues invoke the 'Report a Razor issue' command via the command palette.

[Error - 10:15:17 AM] Server initialization failed.
Message: Internal Error - System.ArgumentNullException: Value cannot be null. (Parameter 'workspaceDirectory')
at Microsoft.AspNetCore.Razor.LanguageServer.ProjectConfigurationFileChangeDetector.StartAsync(String workspaceDirectory, CancellationToken cancellationToken) in //src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectConfigurationFileChangeDetector.cs:line 50
at Microsoft.AspNetCore.Razor.LanguageServer.RazorFileChangeDetectorManager.InitializedAsync() in /
/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorFileChangeDetectorManager.cs:line 46
at Microsoft.AspNetCore.Razor.LanguageServer.RazorLanguageServer.<>c__DisplayClass9_0.<b__3>d.MoveNext() in /_/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs:line 83
--- End of stack trace from previous location ---
at OmniSharp.Extensions.LanguageServer.Server.LanguageServer.MediatR.IRequestHandler<OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams,OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult>.Handle(InitializeParams request, CancellationToken token)
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)
at MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)
at MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate1 next)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(TDescriptor descriptor, Request request, CancellationToken token)
Code: -32602

@NTaylorMullen
Copy link
Contributor

@n3rd253 if you set "razor.disabled" to true does C# IntelliSense work?

@n3rd253
Copy link

n3rd253 commented Sep 3, 2020

@NTaylorMullen I suppose particularly my issue is not intellisense itself. Intellisense is working, but there is no referential integrity.

I cannot click and navigate through references and implementations of things, as it seems there are no such symbols available to traverse.

@NTaylorMullen
Copy link
Contributor

@NTaylorMullen I suppose particularly my issue is not intellisense itself. Intellisense is working, but there is no referential integrity.

I cannot click and navigate through references and implementations of things, as it seems there are no such symbols available to traverse.

Ah, so even without Razor involved (razor.disabled: true) you have issues from the C# perspective. If that's the case then @cartermp you may need to re-triage. We know we have some Razor issues in LiveShare in VSCode and are tracking that here: https://github.com/dotnet/aspnetcore/issues/14294 C# issues would need to be handled from the omnisharp-roslyn layer

@n3rd253
Copy link

n3rd253 commented Sep 3, 2020

@NTaylorMullen this is correct, razor or not I am having issues traversing C# whilst in vscode.

@JoeRobich
Copy link
Member

In LiveShare scenarios we shouldn't try to start OmniSharp at all because it won't have access to the files. All language server responsibilities (limited to those that LiveShare knows about) are handled on the "server".

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

Successfully merging a pull request may close this issue.

5 participants