OmniSharp / omnisharp-sublime

C# IDE Plugin for Sublime Text 3
http://omnisharp-sublime.readthedocs.org/en/latest/
MIT License
551 stars 64 forks source link

OmniSharp: Error talking to localhost #250

Open zshep427 opened 6 years ago

zshep427 commented 6 years ago

Platform

Type

Checklist

Versions

output of mono --version:

5.16.0.179

output of msbuild /version:

Details

This might be less of a bug and more of an issue with my setup. I was using the setup detailed here https://www.youtube.com/watch?v=z7na1MuMDRg and it was working up until about a week ago. I tried several different solutions I found for recent issues I found on the internet (reinstalling from scratch, doubling the time for connection timeout, updating Mono to latest, etc and it keeps failing). I was hoping my problem might just be something obvious I'm not seeing. Every time I launch ST I get the error:

"OmniSharp: Error talking to http://localhost:xxxxx/checkreadystatus"

Thanks in advance for your help! Hopefully it's something simple.

How-To

How do I reproduce this issue?

Rosalie241 commented 6 years ago

read the README, you need msbuild

zshep427 commented 6 years ago

@tim241 Installing msbuild did not resolve the issue, either.

Rosalie241 commented 6 years ago

is it included in your PATH then?

also, what msbuild version do you have?

It all states this clearly in the README

On 20.10 07:27, zshep427 wrote:

@tim241 Installing msbuild did not resolve the issue, either.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/OmniSharp/omnisharp-sublime/issues/250#issuecomment-431633626

zshep427 commented 6 years ago

I added this filepath to PATH: C:\Program Files (x86)\MSBuild\14.0\Bin

Is that correct? It's 2015, downloaded from here: https://www.microsoft.com/en-us/download/details.aspx?id=48159

Thanks for your help!

Rosalie241 commented 6 years ago

seems correct, does it work now or does it still not work?

zshep427 commented 6 years ago

Nope, still doesn't work. Still receiving the same "Error talking to localhost" when I launch Sublime and it attempts to start the server.

Rosalie241 commented 6 years ago

Can you try to execute omnisharp.cmd manually in cmd to see what it says then?

zshep427 commented 6 years ago

Says that omnisharp.cmd is not recognized as a command. Will I not have that if I installed OmniSharp via Package Control?

kufii commented 6 years ago
λ omnisharp.cmd
Application startup exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at OmniSharp.MSBuild.ProjectSystem..ctor(IOmniSharpEnvironment environment, OmniSharpWorkspace workspace, IMSBuildLocator msbuildLocator, IDotNetCliService dotNetCliService, SdksPathResolver sdksPathResolver, MetadataFileReferenceCache metadataFileReferenceCache, IEventEmitter eventEmitter, IFileSystemWatcher fileSystemWatcher, FileSystemHelper fileSystemHelper, ILoggerFactory loggerFactory, IEnumerable`1 eventSinks)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Providers.ImportMany.ImportManyExportDescriptorProvider.<>c__DisplayClass3_2`1.<GetImportManyDescriptor>b__4(ExportDescriptor e)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)
   at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export)
   at System.Composition.CompositionContext.GetExport(CompositionContract contract)
   at System.Composition.CompositionContext.GetExport[TExport](String contractName)
   at OmniSharp.WorkspaceInitializer.Initialize(IServiceProvider serviceProvider, CompositionHost compositionHost)
   at OmniSharp.Http.Startup.Configure(IApplicationBuilder app, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, HttpEnvironment httpEnvironment)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
System.NullReferenceException: Object reference not set to an instance of an object.
   at OmniSharp.MSBuild.ProjectSystem..ctor(IOmniSharpEnvironment environment, OmniSharpWorkspace workspace, IMSBuildLocator msbuildLocator, IDotNetCliService dotNetCliService, SdksPathResolver sdksPathResolver, MetadataFileReferenceCache metadataFileReferenceCache, IEventEmitter eventEmitter, IFileSystemWatcher fileSystemWatcher, FileSystemHelper fileSystemHelper, ILoggerFactory loggerFactory, IEnumerable`1 eventSinks)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Providers.ImportMany.ImportManyExportDescriptorProvider.<>c__DisplayClass3_2`1.<GetImportManyDescriptor>b__4(ExportDescriptor e)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)
   at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export)
   at System.Composition.CompositionContext.GetExport(CompositionContract contract)
   at System.Composition.CompositionContext.GetExport[TExport](String contractName)
   at OmniSharp.WorkspaceInitializer.Initialize(IServiceProvider serviceProvider, CompositionHost compositionHost)
   at OmniSharp.Http.Startup.Configure(IApplicationBuilder app, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, HttpEnvironment httpEnvironment)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at OmniSharp.Http.Host.Start()
   at OmniSharp.Http.Driver.Program.<>c__DisplayClass0_1.<Main>b__1()
   at OmniSharp.HostHelpers.Start(Func`1 action)
Rosalie241 commented 6 years ago

@kufii is the correct msbuild installed?

kufii commented 6 years ago

Yes 2015

Rosalie241 commented 6 years ago

@kufii please show me the output of msbuild /version then :+1:

kufii commented 6 years ago
λ msbuild /version
Microsoft (R) Build Engine version 14.0.23107.0
Copyright (C) Microsoft Corporation. All rights reserved.

14.0.23107.0
VicEsquivel commented 6 years ago

@tim241 I had the same output than @zshep427, saying is not recognized even after installing from the package control. Then I reached the OmniSharp.exe from:

...User\AppData\Roaming\Sublime Text 3\Packages\OmniSharp\prebuilt-omnisharp-roslyn\prebuilt\OmniSharp.exe

and after tryng to execute it, the same output of @kufii

>OmniSharp.exe
Application startup exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at OmniSharp.MSBuild.ProjectSystem..ctor(IOmniSharpEnvironment environment, OmniSharpWorkspace workspace, IMSBuildLocator msbuildLocator, IDotNetCliService dotNetCliService, SdksPathResolver sdksPathResolver, MetadataFileReferenceCache metadataFileReferenceCache, IEventEmitter eventEmitter, IFileSystemWatcher fileSystemWatcher, FileSystemHelper fileSystemHelper, ILoggerFactory loggerFactory, IEnumerable`1 eventSinks)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Providers.ImportMany.ImportManyExportDescriptorProvider.<>c__DisplayClass3_2`1.<GetImportManyDescriptor>b__4(ExportDescriptor e)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)
   at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export)
   at System.Composition.CompositionContext.GetExport(CompositionContract contract)
   at System.Composition.CompositionContext.GetExport[TExport](String contractName)
   at OmniSharp.WorkspaceInitializer.Initialize(IServiceProvider serviceProvider, CompositionHost compositionHost)
   at OmniSharp.Http.Startup.Configure(IApplicationBuilder app, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, HttpEnvironment httpEnvironment)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
System.NullReferenceException: Object reference not set to an instance of an object.
   at OmniSharp.MSBuild.ProjectSystem..ctor(IOmniSharpEnvironment environment, OmniSharpWorkspace workspace, IMSBuildLocator msbuildLocator, IDotNetCliService dotNetCliService, SdksPathResolver sdksPathResolver, MetadataFileReferenceCache metadataFileReferenceCache, IEventEmitter eventEmitter, IFileSystemWatcher fileSystemWatcher, FileSystemHelper fileSystemHelper, ILoggerFactory loggerFactory, IEnumerable`1 eventSinks)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Providers.ImportMany.ImportManyExportDescriptorProvider.<>c__DisplayClass3_2`1.<GetImportManyDescriptor>b__4(ExportDescriptor e)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at lambda_method(Closure , LifetimeContext , CompositionOperation )
   at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
   at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)
   at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export)
   at System.Composition.CompositionContext.GetExport(CompositionContract contract)
   at System.Composition.CompositionContext.GetExport[TExport](String contractName)
   at OmniSharp.WorkspaceInitializer.Initialize(IServiceProvider serviceProvider, CompositionHost compositionHost)
   at OmniSharp.Http.Startup.Configure(IApplicationBuilder app, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, HttpEnvironment httpEnvironment)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at OmniSharp.Http.Host.Start()
   at OmniSharp.Http.Driver.Program.<>c__DisplayClass0_1.<Main>b__1()
   at OmniSharp.HostHelpers.Start(Func`1 action)

My msbuild version:

Microsoft (R) Build Engine version 14.0.23107.0
Copyright (C) Microsoft Corporation. All rights reserved.
Rosalie241 commented 6 years ago

Does omnisharp-sublime 1.9.9 fix it? (I updated omnisharp-roslyn and the msbuild detector seems to be improved)

VicEsquivel commented 6 years ago

@tim241 nope, upgraded and the bug remained, then removed omnisharp and msbuild and started all over again and still the OmniSharp: Error talking to localhost/checkreadystatus

RAISE_OMNI_SHARP_LAUNCHER_EXCEPTION:TypeError("'NoneType' object is not iterable",)
Error launching server
xenonii commented 6 years ago

Today Package Control told me that it failed when upgrading Omnisharp and suggested restarted Sublime. But I'm now getting RAISE_OMNI_SHARP_LAUNCHER_EXCEPTION:TypeError("'NoneType' object is not iterable",)

It was all working fine last week.

Rosalie241 commented 6 years ago

Alright, for 2.0.0 I've reverted the previous commit (the omnisharp-roslyn) update

I'll take a closer look now.

EDIT: I'm sorry for causing any inconveniences, I hope I'll get this fixed ASAP

xenonii commented 6 years ago

@tim241 2.0.0 is working now. Thanks

pixelSmuggler commented 5 years ago

I'm seeing this issue on 2.0.0. This is a fresh install of omniSharp-sublime through Sublime package control. I'm seeing the same Application Startup Exception as @kufii. MsBuild version : 15.1.1012.6693 Mono version : 5.18.0

Rubikoid commented 5 years ago

I'm also had this problem on 2.0.0. About fresh install, by instruction. The same exception on startup as was @kufii. So, it solved by grabbing the lastest for now (v1.32.8) release of omnisharp-roslyn for http-win-x86 (may be the problem was in arch) and replacing with it omnisharp in sublime package.

MightyPrinny commented 5 years ago

On linux I had to install the dot net core sdk https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-2.2.104

yohanmishkin commented 5 years ago

Hey @tim241 thanks for all the great work on this project.

I'm getting the

RAISE_OMNI_SHARP_LAUNCHER_EXCEPTION:TypeError("'NoneType' object is not iterable",)

error running v2.0.0 on OSX as well.

Is this something that might be resolved temporarily by running an earlier version of omnisharp-sublime?

yohanmishkin commented 5 years ago

I was able to get things running by downloading the latest omnisharp-rosyln release:

https://github.com/OmniSharp/omnisharp-roslyn/releases

and manually starting the server with the run script.

Rosalie241 commented 5 years ago

@yohanmishkin are you sure the code is in focus? that error generally only pops up once you have the warning/log window in focus

yohanmishkin commented 5 years ago

Thanks, @tim241. I thought I had the code in focus, but things appear kosher now. So thanks for checking in!

APersonH commented 4 years ago

I'm also getting the OmniSharp: Error talking to localhost/checkreadystatus error on version 2.0.0. My msbuild version:

$ msbuild /version
Microsoft (R) Build Engine version 16.5.0-ci for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

16.5.0.26101

I have installed the net core sdk, and tried manually starting the server

luizfernandonb commented 4 years ago

Any solution for that? I've done everything possible and I haven't solved anything :/

rikai-suru commented 4 years ago

Fascinatingly, I have been trying to make this work in Windows 10 for hours then gave up. In my Linux laptop, it just worked out of the box.

Well to be fair, I already access to Mono and MSBuild in my Linux, so that's most likely the reason why.

Sublime Text and Omnisharp must have access to both Mono and MSBuild. I tried using mono --version and msbuild --version in Windows Terminal (using Powershell), yet none of them worked (even if I have BOTH of them installed, most likely they still aren't in PATH, will test again if I regained my sanity). Bonus points if you use the Terminus package for Sublime Text.

0xPlaydevil commented 4 years ago

Same Error! Same output as @kufii when execute omnisharp.cmd. Solution: I found msbuild /version output right not mean omnisharp server can run correctly. Just adding only the filepath of msbuild.exe to PATH can arrive this. With visual studio installed, it provides vcvars64.bat to set environment correctly, but temporary. So I add call vcvars64.bat to the head of omnisharp.cmd then it works. Remember to add the filepath of vcvars64.bat into the PATH! Good luck!

Feacur commented 3 years ago

@Rosalie241, @0xPlaydevil, Hi! Just out of interest: are you using any specific Visual Studio version [which pretty much implies specific tools version]? Both suggestions don't apear to fix the issue:

Building from source results with the same hurdles. Probably, this plugin strictly requires older tools version (Microsoft Build Tools 2015)? I've even installed dotnet code 2.1.815 to build the sources and then replaced the prebuilt stuff with new binaries - no chance.

Also, it's been around 2 years since the last commit. Is everything's fine, or is it VSCode + ms-dotnettools.csharp who got all the attention instead?

I remember using Sublime with OmniSharp, kek, almost 8 years ago or so - everything was fine then. I'll give the setup a go some time later, probably.