2

我正在尝试使用 Atom 和 OmniSharp 在 Arch Linux 上编写和测试一些 C# 代码。

当我启动 OmniSharp 服务器时,我得到:

**Atom Version**: 1.11.2
**Electron Version**: 1.4.5
**System**: linux 4.8.6-1-ARCH
**Thrown From**: [omnisharp-atom](https://github.com/OmniSharp/omnisharp-atom) package, v0.30.7


### Stack Trace

Uncaught TypeError: Cannot read property 'connect' of undefined

```
At /home/ja/.atom/packages/omnisharp-atom/dist/atom/solution-information.js:63

TypeError: Cannot read property 'connect' of undefined
at atom-workspace.<anonymous> (/home/ja/.atom/packages/omnisharp-atom/dist/atom/solution-information.js:63:86)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/lib/atom/src/command-registry.js:260:29)
at /usr/lib/atom/src/command-registry.js:3:61
at CommandPaletteView.module.exports.CommandPaletteView.confirmed (/usr/lib/atom/node_modules/command-palette/lib/command-palette-view.js:183:32)
at CommandPaletteView.module.exports.SelectListView.confirmSelection (/usr/lib/atom/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
at space-pen-li.<anonymous> (/usr/lib/atom/node_modules/atom-space-pen-views/lib/select-list-view.js:139:19)
at HTMLOListElement.dispatch (/usr/lib/atom/node_modules/jquery/dist/jquery.js:4435:9)
at HTMLOListElement.elemData.handle (/usr/lib/atom/node_modules/jquery/dist/jquery.js:4121:28)
```

### Commands

```
 -0:11.3.0 command-palette:toggle (atom-text-editor.editor.is-focused)
 -0:00.4.0 omnisharp-atom:start-server (atom-text-editor.editor)
```

### Config

```json
{
   "core": {
   "automaticallyUpdate": false,
   "telemetryConsent": "limited"
 },
   "omnisharp-atom": {
    "codeLens": false,
    "enhancedHighlighting19": false
 }
}
```

我也试过 VS Code 有同样的问题,OmniSharp 服务器没有启动(虽然没有错误信息)。

到目前为止,我已经安装omnisharp-roslyn(也没有启动)和dotnet-cli. 我可以在终端dnvm中运行。dnx

我也尝试过使用monodevelop,但是当我尝试打开sln文件(!?)时,它会使 gnome 会话崩溃。

我是否缺少让 OmniSharp 在我的机器上启动的东西?

编辑:这是我尝试从命令行运行omnisharp-roslyn时收到的错误消息:

$ ./OmniSharp.exe
OmniSharp: 

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: System.Native
  at (wrapper managed-to-native) Interop+Sys:GetUnixNamePrivate ()
  at Interop+Sys.GetUnixName () [0x00000] in <862459bd886947438b3fcf70c862f252>:0 
  at System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (System.Runtime.InteropServices.OSPlatform osPlatform) [0x00009] in <862459bd886947438b3fcf70c862f252>:0 
  at Microsoft.Extensions.Logging.Console.ConsoleLogger..ctor (System.String name, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00051] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLoggerImplementation (System.String name) [0x00019] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00037] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLogger (System.String name) [0x00000] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at Microsoft.Extensions.Logging.Logger.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x00000] in <b4eaa2bc235d433795ecf85c2cb89857>:0 
  at Microsoft.Extensions.Logging.LoggerFactory.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x0004e] in <b4eaa2bc235d433795ecf85c2cb89857>:0 
  at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00008] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter) [0x00000] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at OmniSharp.Startup.Configure (Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.IServiceProvider serviceProvider, OmniSharp.Services.IOmnisharpEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.Services.IOmnisharpAssemblyLoader loader, Microsoft.Extensions.Options.IOptions`1[TOptions] optionsAccessor) [0x000c5] in <2fbe1e51b55e440883be6c19e2a55f91>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
   --- End of inner exception stack trace ---
  at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize () [0x00008] in <151cad73211e43ce93bfdfc0a194d607>:0 
  at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build () [0x00061] in <151cad73211e43ce93bfdfc0a194d607>:0 
  at OmniSharp.Program.Main (System.String[] args) [0x002a0] in <2fbe1e51b55e440883be6c19e2a55f91>:0 
  at Program.Main (System.String[] args) [0x00054] in <e93d2c3c555f4da2bb3b91873247bd6e>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: System.Native
  at (wrapper managed-to-native) Interop+Sys:GetUnixNamePrivate ()
  at Interop+Sys.GetUnixName () [0x00000] in <862459bd886947438b3fcf70c862f252>:0 
  at System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (System.Runtime.InteropServices.OSPlatform osPlatform) [0x00009] in <862459bd886947438b3fcf70c862f252>:0 
  at Microsoft.Extensions.Logging.Console.ConsoleLogger..ctor (System.String name, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00051] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLoggerImplementation (System.String name) [0x00019] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00037] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLogger (System.String name) [0x00000] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at Microsoft.Extensions.Logging.Logger.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x00000] in <b4eaa2bc235d433795ecf85c2cb89857>:0 
  at Microsoft.Extensions.Logging.LoggerFactory.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x0004e] in <b4eaa2bc235d433795ecf85c2cb89857>:0 
  at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00008] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter) [0x00000] in <a7a7b43923544c67a09fd7d669fef4c2>:0 
  at OmniSharp.Startup.Configure (Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.IServiceProvider serviceProvider, OmniSharp.Services.IOmnisharpEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.Services.IOmnisharpAssemblyLoader loader, Microsoft.Extensions.Options.IOptions`1[TOptions] optionsAccessor) [0x000c5] in <2fbe1e51b55e440883be6c19e2a55f91>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
   --- End of inner exception stack trace ---
  at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize () [0x00008] in <151cad73211e43ce93bfdfc0a194d607>:0 
  at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build () [0x00061] in <151cad73211e43ce93bfdfc0a194d607>:0 
  at OmniSharp.Program.Main (System.String[] args) [0x002a0] in <2fbe1e51b55e440883be6c19e2a55f91>:0 
  at Program.Main (System.String[] args) [0x00054] in <e93d2c3c555f4da2bb3b91873247bd6e>:0 `

编辑 2:我现在可以按照本次讨论omnisharp-roslyn结束时的建议重命名System.Runtime.InteropServices.RuntimeInformation.dll为另一个名称来运行。Omnisharp 在 VS Code 上工作,但在 Atom 上仍然没有运气......

编辑 3:我现在可以从~/.atom/packages/omnisharp-atom/node_modules/omnisharp-client. 单声道版本使用与上述相同的修复程序工作,ubuntu14-x64-netcoreapp1.0 在从 AUR 安装 icu52 后工作。我尝试使用正在运行的omnisharp 服务器启动Atom,localhost:2000但无济于事。

4

0 回答 0