Skip to content

v2.0.0-preview.6 fails with OmniSharp Error: System.InvalidOperationException: This operation is not supported for a relative URI. #1104

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

Closed
ant-druha opened this issue Nov 16, 2019 · 16 comments
Labels

Comments

@ant-druha
Copy link
Contributor

Full trace is

2019-11-16 15:30:40.421 +03:00 [INF] highlight handler loaded
2019-11-16 15:30:40.472 +03:00 [DBG] Finding descriptor for initialize
2019-11-16 15:30:40.590 +03:00 [DBG] Starting: Routing Request (1) initialize
2019-11-16 15:30:40.598 +03:00 [DBG] Converting params for Request (1) initialize to OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams
2019-11-16 15:30:40.656 +03:00 [FTL] Failed to handle notification initialize
System.InvalidOperationException: This operation is not supported for a relative URI.
   at System.Uri.get_AbsolutePath()
   at OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeParams.get_RootPath()
   at Microsoft.PowerShell.EditorServices.Server.PsesLanguageServer.<>c.<<StartAsync>b__18_3>d.MoveNext() in D:\a\1\s\src\PowerShellEditorServices\Server\PsesLanguageServer.cs:line 114
--- End of stack trace from previous location where exception was thrown ---
   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.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(TDescriptor descriptor, Request request, CancellationToken token)
2019-11-16 15:30:40.674 +03:00 [DBG] Finished: Routing Request (1) initialize in 77ms

EditorServices-IJ-2.log
Start-EditorServices-EditorServices-IJ-2.log

@ghost ghost added the Needs: Triage Maintainer attention needed! label Nov 16, 2019
@TylerLeonhardt
Copy link
Member

@ant-druha does Intelij offer the ability to see the payloads of the requests that are being sent to and from it via the language server protocol?

I get the feeling that the issue here is that that is sending a relative path for the "rootPath" property of the initialize request... where vscode always sends absolute paths.

@david-driscoll @mholo65 this is a solid reason for OmniSharp/csharp-language-server-protocol#181

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 16, 2019
@TylerLeonhardt TylerLeonhardt added Needs-Repro-Info and removed Needs: Maintainer Attention Maintainer attention needed! Needs: Triage Maintainer attention needed! labels Nov 16, 2019
@ant-druha
Copy link
Contributor Author

The path is absolute. Attached the dump file.
protocol_messages_IJ.log

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 17, 2019
@TylerLeonhardt
Copy link
Member

Thanks for the context @ant-druha and apologies for the issues here - it was a particularly large change that went into preview.6

Would you mind trying a build from master? I did make a change in the exact spot that threw the exception and am curious if the issue is already fixed.

@ant-druha
Copy link
Contributor Author

ant-druha commented Nov 17, 2019

Would you mind trying a build from master?

Sure @TylerLeonhardt Actually, could you advise how do I release the build package to try? Thanks.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 17, 2019
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Nov 19, 2019

PowerShellEditorServices.zip

Here you go 😄 let us know how it goes @ant-druha!

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 19, 2019
@ant-druha
Copy link
Contributor Author

Thanks! But, unfortunately, same issue.
EditorServices-IJ-0.log
[Uploading

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 20, 2019
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Nov 20, 2019

PowerShellEditorServices.zip

Sorry that last one didn't fix it - but I'm fairly confident this one will, @ant-druha!

This comes from #1110

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 20, 2019
@ant-druha
Copy link
Contributor Author

ant-druha commented Nov 20, 2019

@TylerLeonhardt that did it! It fixed the reported issue.

Unfortunately, I'm getting different error now, related to protocol messaging. My client gets unexpected content in incoming message:

Nov 20, 2019 11:17:51 AM org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor run
SEVERE: java.lang.IllegalStateException: Expected a boolean but was BEGIN_OBJECT at line 1 column 499 path $.result.capabilities.codeActionProvider
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a boolean but was BEGIN_OBJECT at line 1 column 499 path $.result.capabilities.codeActionProvider
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	at com.google.gson.Gson.fromJson(Gson.java:927)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapterFactory$Adapter.read(MessageTypeAdapterFactory.java:116)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapterFactory$Adapter.read(MessageTypeAdapterFactory.java:61)
	at com.google.gson.Gson.fromJson(Gson.java:927)
	at com.google.gson.Gson.fromJson(Gson.java:892)
	at com.google.gson.Gson.fromJson(Gson.java:841)
	at com.google.gson.Gson.fromJson(Gson.java:813)
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:78)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:148)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:84)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Expected a boolean but was BEGIN_OBJECT at line 1 column 499 path $.result.capabilities.codeActionProvider
	at com.google.gson.stream.JsonReader.nextBoolean(JsonReader.java:853)
	at com.google.gson.internal.bind.TypeAdapters$3.read(TypeAdapters.java:144)
	at com.google.gson.internal.bind.TypeAdapters$3.read(TypeAdapters.java:133)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	... 18 more

Need to investigate, may be some headers have changed.

But anyway the initial issue is resolved. Please feel free to close this issue, thanks!
protocol_messages_IJ.log

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 20, 2019
@bjorkstromm
Copy link
Contributor

@ant-druha The issue you are seeing is probably related to the the C# LSP implementation sends a CodeActionOptions instead of a boolean in the ServerCapabilities object during init. I know we have been bad at honoring the client requests during init regarding these. // cc @david-driscoll

interface ServerCapabilities {
        ...
   
       /**
	 * The server provides code actions. The `CodeActionOptions` return type is only
	 * valid if the client signals code action literal support via the property
	 * `textDocument.codeAction.codeActionLiteralSupport`.
	 */
	codeActionProvider?: boolean | CodeActionOptions;

        ...
}

@ant-druha
Copy link
Contributor Author

@mholo65 I've updated lsp4j library to latest one and it worked. Thanks 👍

@TylerLeonhardt
Copy link
Member

@ant-druha so it sounds like you'll be unblocked and intellij-powershell will be able to use the next Preview? 😊

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 20, 2019
@ant-druha
Copy link
Contributor Author

Yes, this great! Not sure about bundled it yet, though. As this will not work with 5 and older versions. I might need to provide some hint for them.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 20, 2019
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Nov 20, 2019

FWIW, the single telemetry data point we get from the vscode extension shows that almost no one is using v3 or v4 within their editor.

They might have v3 or v4 on a server somewhere, but they don't seem to be using it with the vscode extension.

Have you seen something else?

The PSReadLine we need only supports v5.1+ so we have no choice here and across the board said we won't support it. You could try using the useLegacyReadLine setting with v3 or v4 but I can't promise it will work and can't support it.

@rjmholt
Copy link
Contributor

rjmholt commented Nov 21, 2019

As this will not work with 5 and older versions. I might need to provide some hint for them.

Should work with 5.1 and up. (5.0 hasn't been around for a while, since 5.1 was a mandatory upgrade)

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 21, 2019
@TylerLeonhardt
Copy link
Member

@ant-druha have you given this another go? We've changed quite a bit under the hood so you should have a better experience.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 5, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Mar 5, 2020
@TylerLeonhardt
Copy link
Member

@ant-druha this should be working now. I'm gonna close this but let me know if you still see the issue!

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 15, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants