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

Server doesn't work with mono 4.8 #439

Closed
mickaelistria opened this issue Jul 31, 2017 · 23 comments
Closed

Server doesn't work with mono 4.8 #439

mickaelistria opened this issue Jul 31, 2017 · 23 comments

Comments

@mickaelistria
Copy link

A recent change to better support mono 5.2 ( 12cf220 ) seems to break support for mono 4.8.

Most operations either timeout or return empty results when something is expected

Here are some of the 1st few messages received from LS after an initialize request as example

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.Startup\",\"Message\":\"Omnisharp server running using Stdio at location '/home/mistria/runtime-demoLSP/csharp-in-Eclipse3' on host 17522.\"},\"Seq\":1,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.DotNet.DotNetProjectSystem\",\"Message\":\"Initializing in /home/mistria/runtime-demoLSP/csharp-in-Eclipse3\"},\"Seq\":2,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.DotNet.DotNetProjectSystem\",\"Message\":\"Auto package restore: True\"},\"Seq\":3,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.DotNet.DotNetProjectSystem\",\"Message\":\"Update workspace context\"},\"Seq\":4,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.DotNet.DotNetProjectSystem\",\"Message\":\"Resolving projects references\"},\"Seq\":5,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.MSBuild.MSBuildProjectSystem\",\"Message\":\"MSBUILD_EXE_PATH environment variable set to /home/mistria/git/aCute/org.eclipse.acute.omnisharpServer/server/omnisharp-node-client-7.0.7/omnisharp-mono/msbuild/MSBuild.dll\"},\"Seq\":6,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.MSBuild.MSBuildProjectSystem\",\"Message\":\"MSBuildExtensionsPath environment variable set to /home/mistria/git/aCute/org.eclipse.acute.omnisharpServer/server/omnisharp-node-client-7.0.7/omnisharp-mono/msbuild\"},\"Seq\":7,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.MSBuild.MSBuildProjectSystem\",\"Message\":\"MSBuild will use local OmniSharp installation.\"},\"Seq\":8,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.MSBuild.MSBuildProjectSystem\",\"Message\":\"No solution files found in '/home/mistria/runtime-demoLSP/csharp-in-Eclipse3'\"},\"Seq\":9,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.MSBuild.MSBuildProjectSystem\",\"Message\":\"Loading project: /home/mistria/runtime-demoLSP/csharp-in-Eclipse3/csharp-in-Eclipse3.csproj\"},\"Seq\":10,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Type\":\"unknown\",\"Event\":\"unknown\",\"Seq\":-1,\"Body\":{\"Message\":\"Discovered Mono file path: /usr/bin/mono\"}}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Type\":\"unknown\",\"Event\":\"unknown\",\"Seq\":-1,\"Body\":{\"Message\":\"Resolved symbolic link for Mono file path: /usr/bin/mono-sgen\"}}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"ERROR\",\"Name\":\"OmniSharp.MSBuild.ProjectFile.ProjectFileInfo\",\"Message\":\"The \\\"Microsoft.NET.Build.Tasks.ReportAssetsLogMessages\\\" task could not be loaded from the assembly /usr/lib64/dotnet/sdk/2.0.0-preview2-006497/Sdks/Microsoft.NET.Sdk/build/../tools/net46/Microsoft.NET.Build.Tasks.dll. Could not load file or assembly '/usr/lib64/dotnet/sdk/2.0.0-preview2-006497/Sdks/Microsoft.NET.Sdk/build/../tools/net46/Microsoft.NET.Build.Tasks.dll' or one of its dependencies Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.\"},\"Seq\":11,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"WARNING\",\"Name\":\"OmniSharp.MSBuild.MSBuildProjectSystem\",\"Message\":\"Failed to load project file '/home/mistria/runtime-demoLSP/csharp-in-Eclipse3/csharp-in-Eclipse3.csproj'.\"},\"Seq\":12,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"MsBuildProjectDiagnostics\",\"Body\":{\"FileName\":\"/home/mistria/runtime-demoLSP/csharp-in-Eclipse3/csharp-in-Eclipse3.csproj\",\"Warnings\":[],\"Errors\":[{\"LogLevel\":\"Error\",\"FileName\":\"/usr/lib64/dotnet/sdk/2.0.0-preview2-006497/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets\",\"Text\":\"The \\\"Microsoft.NET.Build.Tasks.ReportAssetsLogMessages\\\" task could not be loaded from the assembly /usr/lib64/dotnet/sdk/2.0.0-preview2-006497/Sdks/Microsoft.NET.Sdk/build/../tools/net46/Microsoft.NET.Build.Tasks.dll. Could not load file or assembly '/usr/lib64/dotnet/sdk/2.0.0-preview2-006497/Sdks/Microsoft.NET.Sdk/build/../tools/net46/Microsoft.NET.Build.Tasks.dll' or one of its dependencies Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.\",\"StartLine\":322,\"StartColumn\":5,\"EndLine\":0,\"EndColumn\":0}]},\"Seq\":13,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.Script.ScriptProjectSystem\",\"Message\":\"Detecting CSX files in '/home/mistria/runtime-demoLSP/csharp-in-Eclipse3'.\"},\"Seq\":14,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.Script.ScriptProjectSystem\",\"Message\":\"Could not find any CSX files\"},\"Seq\":15,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.Services.WorkspaceHelper\",\"Message\":\"Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider\"},\"Seq\":16,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"Name\":\"OmniSharp.Startup\",\"Message\":\"Configuration finished.\"},\"Seq\":17,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"Event\":\"started\",\"Body\":null,\"Seq\":18,\"Type\":\"event\"}"}}
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{\"clientId\":\"client1\",\"command\":\"/diagnostics\",\"request\":{},\"silent\":false,\"sequence\":\"__request2\",\"time\":\"2017-07-31T10:06:52.346Z\"}"}}
{"jsonrpc":"2.0","id":"1","result":{"capabilities":{"textDocumentSync":2,"completionProvider":{},"codeLensProvider":{"resolveProvider":true},"definitionProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[";"]},"documentHighlightProvider":true,"documentRangeFormattingProvider":true,"hoverProvider":true,"referencesProvider":true,"renameProvider":true,"signatureHelpProvider":{"triggerCharacters":["("]},"workspaceSymbolProvider":true,"extended":{"getCodeActionsProvider":true,"runCodeActionProvider":true,"implementationProvider":true,"navigateProvider":true,"highlightProvider":true}}}}

My setup:

$ mono --version
Mono JIT compiler version 4.8.0 (Stable 4.8.0.520/8f6d0f6 Wed Mar 15 15:23:40 UTC 2017)
$ dotnet --version
2.0.0-preview2-006497
@mickaelistria
Copy link
Author

cc @AndrienkoAleksandr : this is the issue I've told you about, with more details. Feel free to ask for more if it can help. I'll try with mono 5.2 soon and report whether this fix the issue.

@mickaelistria
Copy link
Author

I just tried again with the LS from master (which includes 12cf220 ).

$ mono --version
Mono JIT compiler version 5.2.0.213 (tarball Wed Jul 26 18:27:56 UTC 2017)
$ dotnet --version
2.0.0-preview2-006497

The LS is working fine for projects which have a project.json file and returns empty results for projects with a .csproj file. So it's working well with mono 5.2, but doesn't fix https://github.com/mickaelistria/aCute/issues/51

@AndrienkoAleksandr
Copy link
Contributor

AndrienkoAleksandr commented Jul 31, 2017

@mickaelistria Did you generate project with help dotnet 2.0? Because for me this commit activated inside Eclipse CHE correct autocomplete, hover, for dotnet projects generated with help dotnet 2.0 (I don't use project generated with help 1.0.4).

@mickaelistria
Copy link
Author

Project is generated with dotnet new command.

@DustinCampbell
Copy link

Unfortunately, in order to support .NET Core 2.0, OmniSharp needs to take advantage of the new "--assembly-loader" flag in Mono 5.2. This is, due to internal API changes in the latest .NET Core 2.0 SDK. There are several issues with details. Here's one where the problem is discussed at length: dotnet/vscode-csharp#1495

@mickaelistria
Copy link
Author

Thanks @DustinCampbell . Is there an easy way to check for mono version (maybe you're already aware of some dependency that can do it) and to decide whether to set the flag according to it?
I have the impression having the flag makes previous versions of mono entirely fail at booting Omnisharp, so it would be nice to keep those older versions of mono remain at least able to do the work they used to do with omnisharp-node-client.

@DustinCampbell
Copy link

In Node? I'd probably just regex out the version number from mono --version and then use the semver package.

Note that without the flag, using the latest .NET Core 2.0 SDK will still fail on old versions of Mono.

@mickaelistria
Copy link
Author

mickaelistria commented Aug 2, 2017 via email

@DustinCampbell
Copy link

Makes sense. One thing to keep in mind is that it isn't about building .NET Core 2.0 apps. The issue is with using the .NET Core 2.0 SDK, which can still be used to build .NET Core 1.1 apps.

@mickaelistria
Copy link
Author

mickaelistria commented Aug 8, 2017

#441 helps as it removes the dependency on mono and then make the setup more portable.
However, I now get the following error notification from server:

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{"Event":"log","Body":{"LogLevel":"ERROR","Name":"OmniSharp.MSBuild.ProjectFile.ProjectFileInfo","Message":"The \"Microsoft.NET.Build.Tasks.ReportAssetsLogMessages\" task could not be loaded from the assembly /usr/lib64/dotnet/sdk/2.0.0-preview2-006497/Sdks/Microsoft.NET.Sdk/build/../tools/net46/Microsoft.NET.Build.Tasks.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask."},"Seq":9,"Type":"event"}"}}

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{"Event":"log","Body":{"LogLevel":"WARNING","Name":"OmniSharp.MSBuild.MSBuildProjectSystem","Message":"Failed to load project file '/home/mistria/runtime-EclipseApplication/someProjecg/someProjecg.csproj'."},"Seq":10,"Type":"event"}"}

I confirm it's using the omnisharp-linux-x64 server with the embedded mono.

As I'm not a .NET expert, I'm failing at interpreting that message.
Does anyone know what this could mean? cc @david-driscoll

@DustinCampbell
Copy link

You might try updating the .NET Core 2.0 SDK. 2.0.0-preview2-006497 is pretty old and there were definitely some issues with MSBuild task dependencies in the past. You should be able to get the latest here: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-sdk-latest-linux-x64.tar.gz.

@DustinCampbell
Copy link

Note: I listed the tarball because, IIRC, you're on Fedora 26.

@mickaelistria
Copy link
Author

mickaelistria commented Aug 8, 2017

@DustinCampbell thanks.
@omajid Do you know if more recent rpms of dotnet-core 2.0 are available for Fedora 26 ?

@DustinCampbell
Copy link

The latest RPM for RHEL is here: https://github.com/dotnet/cli/tree/release/2.0.0.

@mickaelistria
Copy link
Author

mickaelistria commented Aug 8, 2017 via email

@omajid
Copy link

omajid commented Aug 8, 2017

@omajid Do you know if more recent rpms of dotnet-core 2.0 are available for Fedora 26 ?

Preview 2 should be here: https://copr.fedorainfracloud.org/coprs/g/dotnet-sig/dotnet/. We dont have anything newer (yet).

@DustinCampbell
Copy link

@mickaelistria: If you could try the tarball to verify whether that solves the issue or not would be helpful.

@mickaelistria
Copy link
Author

mickaelistria commented Aug 8, 2017 via email

@mickaelistria
Copy link
Author

So the server works for project using a project.json but I still see the same issue for project with *.csproj and dotnet 2.0.1-servicing-006924 from the zip you linked.
How does OmniSharp detect the dotnet executable and framework? Is only having dotnet in PATH enough?

@mickaelistria
Copy link
Author

Actually, the error is different now

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"{"Event":"log","Body":{"LogLevel":"ERROR","Name":"OmniSharp.MSBuild.ProjectFile.ProjectFileInfo","Message":"The specified task executable location \"/csc.exe\" is invalid."},"Seq":9,"Type":"event"}"}}

I guess I didn't install .NET Core properly so some binaries can't be resolved.

@DustinCampbell
Copy link

awesome! That's what I was hoping for. 😄

This is a regression that I noticed earlier today. I've already merged a fix and produced a new 1.23.1 release of omnisharp-roslyn. I'm guessing omnisharp-node-client needs updated @david-driscoll?

@mickaelistria
Copy link
Author

Hurray! I tried the latest release v7.1.2 which uses omnisharp-roslyn 1.23.1 and it worked well on Fedora 26 with a version recent of dotnet-core 2.0 and no dependency on mono!
I believe it's a pretty satisfying result from integrator and user POV, so I'm closing this issue.
Thanks for your assistance!

@DustinCampbell
Copy link

Great!

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

Successfully merging a pull request may close this issue.

4 participants