OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
514 stars 94 forks source link

OmniSharp on GuixSD/NixOS #471

Closed brettgilio closed 5 years ago

brettgilio commented 5 years ago

Hi, I am trying to use OmniSharp on GuixSD/NixOS-like distributions (currently GuixSD, but the issue should be the same on either side). In the past this used to be a semi-trivial process that took some modifications to get it to work. Previously, I would simply M-x omnisharp-install-server, and then patch the shell shebang in the run wrapper to whatever which bash would display. From there, since Mono was compiled on a differently configured system with a static location for the linker, I would install Mono from Nix, delete the provided Mono binary, and symlink the Mono provided from Nix to the bin directory of the server.

This USED to work. Now, I am getting this error when I try to start the server. The debug log doesnt produce anything.

[14:29:32] Using server binary on ~/Repos/.emacs.d/.cache/run
[14:29:32] --> 1 /codecheck ((Arguments (FileName . "/home/brettg/Repos/cstest/Program.cs") (Line . "1") (Column . "1") (Buffer . "using System;

namespace cstest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(\"Hello World!\");
        }
    }
}
")) (Command . "/codecheck") (Seq . 1))
[14:29:32] INFORMATION: OmniSharp.Stdio.Host, Starting OmniSharp on Linux 0.0 (x64)
[14:29:32] INFORMATION: OmniSharp.Services.DotNetCliService, DotNetPath set to dotnet
[14:29:32] WARNING: OmniSharp.MSBuild.Discovery.Providers.MonoInstanceProvider, It looks like you have Mono 5.2.0 or greater installed but MSBuild could not be found.
Try installing MSBuild into Mono (e.g. 'sudo apt-get install msbuild') to enable better MSBuild support.
[14:29:32] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/brettg/Repos/.emacs.d/.cache/omnisharp/msbuild/15.0/Bin"
[14:29:32] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/home/brettg/Repos/.emacs.d/.cache/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[14:29:32] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/home/brettg/Repos/.emacs.d/.cache/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /nix/store/hq229p9rjhssracwbmc7wvipnj2mz5xz-mono-5.16.0.220/lib/mono/xbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /home/brettg/Repos/.emacs.d/.cache/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/brettg/Repos/.emacs.d/.cache/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /nix/store/hq229p9rjhssracwbmc7wvipnj2mz5xz-mono-5.16.0.220/lib/mono/xbuild-frameworks
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 83) reading input System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (13) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean icase, System.RuntimeType reflectedType) [0x0001b] in <68e66ea0659e4a84a28ee2865f464a7b>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <68e66ea0659e4a84a28ee2865f464a7b>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <68e66ea0659e4a84a28ee2865f464a7b>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00006] in <68e66ea0659e4a84a28ee2865f464a7b>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.CompositionHostBuilder.Build () [0x001f6] in <a8c81a634bf945b6a56af4cdc8beb135>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x00057] in <27cd2bf1a94e44fd9b1c5d6ad244fdef>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x00138] in <b1bb9133e2854993a70752af757eed11>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <a8c81a634bf945b6a56af4cdc8beb135>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00039] in <344a1e8cd6594b17b1e01f8df6ae8827>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <a8c81a634bf945b6a56af4cdc8beb135>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <b1bb9133e2854993a70752af757eed11>:0 
[14:29:32] omnisharp--json-read-from-string error: (json-readtable-error 97) reading input   at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <a8c81a634bf945b6a56af4cdc8beb135>:0 
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (13) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies."))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)"))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean icase, System.RuntimeType reflectedType) [0x0001b] in <68e66ea0659e4a84a28ee2865f464a7b>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <68e66ea0659e4a84a28ee2865f464a7b>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <68e66ea0659e4a84a28ee2865f464a7b>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00006] in <68e66ea0659e4a84a28ee2865f464a7b>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.CompositionHostBuilder.Build () [0x001f6] in <a8c81a634bf945b6a56af4cdc8beb135>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x00057] in <27cd2bf1a94e44fd9b1c5d6ad244fdef>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x00138] in <b1bb9133e2854993a70752af757eed11>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <a8c81a634bf945b6a56af4cdc8beb135>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00039] in <344a1e8cd6594b17b1e01f8df6ae8827>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <a8c81a634bf945b6a56af4cdc8beb135>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <b1bb9133e2854993a70752af757eed11>:0 "))
[14:29:32] <-- Received an unknown server packet: ((ServerMessageParseError . "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically.") (Message . "  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <a8c81a634bf945b6a56af4cdc8beb135>:0 "))

I'd like to get this to work again, rather than doing my C# work in a virtual machine. Any thoughts?

Edit: I am getting this from MELPA

razzmatazz commented 5 years ago

Hi @brettgilio It is hard for me to suggest you anything as I am not working on the server.. Apart from trying another/later version of mono?

Could you register the issue in https://github.com/OmniSharp/omnisharp-roslyn/issues/? omnisharp-roslyn project maintains the actual server binary and they may provide you with workarounds.

brettgilio commented 5 years ago

I have done so, thank you!