I’m using VS Code to try out ASP.NET a little bit, but when I try to do:
dnu restore
it fails.
If I try to do it within VS Code I get a error message:
Omnisharp server not running.
I don’t really know what to do
I’m running Windows 10 x64
asked Feb 5, 2016 at 16:34
6
Tried almost everything (resetting settings, reinstalling VS Code) to no avail. Finally I’ve downgraded VS Code C# extension from 1.25.0 to 1.24.4, and it worked perfectly.
answered May 31, 2022 at 6:36
Liam KernighanLiam Kernighan
2,2471 gold badge21 silver badges23 bronze badges
2
Check the vs code Omnisharp log, Ctrl + Shift + U.
The Omnisharp server is not running
error can result from a problem in your project.json
causing issues with dnu restore
. e.g. Issues resolving packages for one of the target frameworks?
It probably will not help but, you can try restarting Omnisharp : F1 «omni restart»
C# support is not bundled but it does sound like you have successfully installed it. Otherwise add C# with F1 «ext install», Enter, «C#»
You are right that there is little documentation
- https://code.visualstudio.com/docs/languages/csharp — introduction to project types and omnisharp
https://docs.asp.net/en/latest/tutorials/your-first-mac-aspnet.html — yes OSX because windows instructions are for Visual Studio(page no longer available)- https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/ — expect better soon
answered Apr 26, 2016 at 3:30
KCDKCD
9,7155 gold badges65 silver badges75 bronze badges
Visual Studio Code has Omnisharp built in. However, that doesn’t mean you don’t have to install ASP.NET 5 and DNX.
Follow the instructions found on this guide: https://code.visualstudio.com/Docs/runtimes/ASPnet5
Specifically, you’ll want to follow these instructions: https://github.com/aspnet/home#upgrading-dnvm-or-running-without-visual-studio
Remember, Visual Studio is the heavyweight IDE that installs all that you need. Visual Studio Code is the lightweight node based editor that only has what you explicitly install/add to it. Thus, unlike Visual Studio, it does not automagically download ASP.NET 5 and DNX
answered Feb 6, 2016 at 23:17
Tobiah ZarlezTobiah Zarlez
1,6501 gold badge11 silver badges13 bronze badges
Another potential solution for folks in 2022 and later (IF the world is still here) —
- Open VSCode Preferences —> Settings
- Search «Use Modern Net»
- Disable «Omnisharp: Use Modern Net»
- Restart VSCode
- (Optional) Check «Output» window (select C# or Omnisharp)
- Great Success (and/or soul-crushing disappointment)
Read the settings tooltip on that «Use Modern Net» option and see if it applies to your case. If you’re using some versions >= than what this setting is for, you may have some other thing going on… In which case, I would recommend looking in that «Output» window at the bottom of VSCode and selecting C# and/or Omnisharp to see what errors it throws for debugging purposes. Hope this helps!
answered Aug 8, 2022 at 5:50
I solve this following this steps:
- Goto VSCODE -> File -> Preferences -> Settings
- Type «omnisharp» in the search toolbox
- Disable the «Omnisharp: Auto Start» checkbox
- Restart VSCODE
- Type ctrl + shift + p to show the command textbox and look for
«Omnisharp: restart omnisharp»
Now you can use «.Net: Generate assets for build and debug»
Joe
8,0113 gold badges17 silver badges23 bronze badges
answered Sep 6, 2021 at 4:07
tapatiotapatio
3871 gold badge4 silver badges9 bronze badges
1
I completely uninstalled the C# extension. Reinstalled it and change the Omnisharp timeout to 15 seconds (initially was 60). Works like a charm.
answered Dec 17, 2020 at 4:42
I installed .NET SDK latest, and restart VScode. I were resolved problem. I so hope with you
answered Jul 18, 2022 at 4:17
Most of the new omnisharp server problems are originated from your outdated dotnet version. I upgraded from .NET 5 to .NET 6.0, now it rocks!
Check your current version by writing «dotnet —version» to your terminal.
And download the .NET 6 from the following link
answered Sep 7, 2022 at 11:43
Click f1 key or ctrl+shift+p to open the textbox to enter your command. Then type omnisharp server, and select the option ‘Restart omnisharp server’.
You can look at its status in the bottom left corner of the window, and if you click on it, the process’s status will on be displayed on the terminal.
answered Jul 25, 2021 at 14:52
I had this problem when I opened the .cs file separately, but then I right-clicked the project folder and chose «Open with VSCode» and it worked fine
answered Jun 30, 2021 at 6:12
SurbowlSurbowl
1291 silver badge5 bronze badges
I’m using VS Code to try out ASP.NET a little bit, but when I try to do:
dnu restore
it fails.
If I try to do it within VS Code I get a error message:
Omnisharp server not running.
I don’t really know what to do
I’m running Windows 10 x64
asked Feb 5, 2016 at 16:34
6
Tried almost everything (resetting settings, reinstalling VS Code) to no avail. Finally I’ve downgraded VS Code C# extension from 1.25.0 to 1.24.4, and it worked perfectly.
answered May 31, 2022 at 6:36
Liam KernighanLiam Kernighan
2,2471 gold badge21 silver badges23 bronze badges
2
Check the vs code Omnisharp log, Ctrl + Shift + U.
The Omnisharp server is not running
error can result from a problem in your project.json
causing issues with dnu restore
. e.g. Issues resolving packages for one of the target frameworks?
It probably will not help but, you can try restarting Omnisharp : F1 «omni restart»
C# support is not bundled but it does sound like you have successfully installed it. Otherwise add C# with F1 «ext install», Enter, «C#»
You are right that there is little documentation
- https://code.visualstudio.com/docs/languages/csharp — introduction to project types and omnisharp
https://docs.asp.net/en/latest/tutorials/your-first-mac-aspnet.html — yes OSX because windows instructions are for Visual Studio(page no longer available)- https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/ — expect better soon
answered Apr 26, 2016 at 3:30
KCDKCD
9,7155 gold badges65 silver badges75 bronze badges
Visual Studio Code has Omnisharp built in. However, that doesn’t mean you don’t have to install ASP.NET 5 and DNX.
Follow the instructions found on this guide: https://code.visualstudio.com/Docs/runtimes/ASPnet5
Specifically, you’ll want to follow these instructions: https://github.com/aspnet/home#upgrading-dnvm-or-running-without-visual-studio
Remember, Visual Studio is the heavyweight IDE that installs all that you need. Visual Studio Code is the lightweight node based editor that only has what you explicitly install/add to it. Thus, unlike Visual Studio, it does not automagically download ASP.NET 5 and DNX
answered Feb 6, 2016 at 23:17
Tobiah ZarlezTobiah Zarlez
1,6501 gold badge11 silver badges13 bronze badges
Another potential solution for folks in 2022 and later (IF the world is still here) —
- Open VSCode Preferences —> Settings
- Search «Use Modern Net»
- Disable «Omnisharp: Use Modern Net»
- Restart VSCode
- (Optional) Check «Output» window (select C# or Omnisharp)
- Great Success (and/or soul-crushing disappointment)
Read the settings tooltip on that «Use Modern Net» option and see if it applies to your case. If you’re using some versions >= than what this setting is for, you may have some other thing going on… In which case, I would recommend looking in that «Output» window at the bottom of VSCode and selecting C# and/or Omnisharp to see what errors it throws for debugging purposes. Hope this helps!
answered Aug 8, 2022 at 5:50
I solve this following this steps:
- Goto VSCODE -> File -> Preferences -> Settings
- Type «omnisharp» in the search toolbox
- Disable the «Omnisharp: Auto Start» checkbox
- Restart VSCODE
- Type ctrl + shift + p to show the command textbox and look for
«Omnisharp: restart omnisharp»
Now you can use «.Net: Generate assets for build and debug»
Joe
8,0113 gold badges17 silver badges23 bronze badges
answered Sep 6, 2021 at 4:07
tapatiotapatio
3871 gold badge4 silver badges9 bronze badges
1
I completely uninstalled the C# extension. Reinstalled it and change the Omnisharp timeout to 15 seconds (initially was 60). Works like a charm.
answered Dec 17, 2020 at 4:42
I installed .NET SDK latest, and restart VScode. I were resolved problem. I so hope with you
answered Jul 18, 2022 at 4:17
Most of the new omnisharp server problems are originated from your outdated dotnet version. I upgraded from .NET 5 to .NET 6.0, now it rocks!
Check your current version by writing «dotnet —version» to your terminal.
And download the .NET 6 from the following link
answered Sep 7, 2022 at 11:43
Click f1 key or ctrl+shift+p to open the textbox to enter your command. Then type omnisharp server, and select the option ‘Restart omnisharp server’.
You can look at its status in the bottom left corner of the window, and if you click on it, the process’s status will on be displayed on the terminal.
answered Jul 25, 2021 at 14:52
I had this problem when I opened the .cs file separately, but then I right-clicked the project folder and chose «Open with VSCode» and it worked fine
answered Jun 30, 2021 at 6:12
SurbowlSurbowl
1291 silver badge5 bronze badges
Issue Description
Steps to Reproduce
Open solution directory, any .cs file, Intellisense is not working.
Also, trying a command such as ‘.NET: Restore Project’ resulted in an error (OmniSharp server is not running.)
Expected Behavior
Working Intellisense
Actual Behavior
No Omnisharp features are working. Looks like the Omnisharp server never loads. There is no process with PID: 21916 (from Omnisharp log) in Windows Task Manager.
Windows Event Logs don’t show any errors. When I start omnisharp.exe manually, I can see it in the task manager, but VScode still says the server is not running.
Things I’ve tried:
- Restarting Omnisharp
- Increasing server load timeout to 1200
- Reinstalling Omnisharp (past 3 versions)
- Reinstalling VScode
Logs
OmniSharp log
Starting OmniSharp server at 7/12/2020, 5:13:55 PM
Target: j:DropboxProjectsUdemyReactivitiesReactivities.sln
OmniSharp server started.
Path: c:Userstauno.vscodeextensionsms-dotnettools.csharp-1.22.1.omnisharp1.35.4-beta.40OmniSharp.exe
PID: 21916
The screen cannot be set to the number of lines and columns specified.
[ERROR] Error: OmniSharp server load timed out. Use the ‘omnisharp.projectLoadTimeout’ setting to override the default delay (one minute).
C# log
Getting latest OmniSharp version information
Downloading package ‘Latest OmniSharp Version Information’ (1 KB)……………….. Done!
Environment information
VSCode version: 1.47.0
C# Extension: 1.22.1
Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk3.1.201
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.202 [C:Program Filesdotnetsdk]
2.1.700 [C:Program Filesdotnetsdk]
2.2.100 [C:Program Filesdotnetsdk]
2.2.207 [C:Program Filesdotnetsdk]
3.0.100 [C:Program Filesdotnetsdk]
3.1.201 [C:Program Filesdotnetsdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-dotnettools | 1.22.1 |
λ 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)
I have a problem and searched over the internet and tried their solutions but nothing happend.
When i try to debug my code in VSCode , nothing happens.
I found in Debug menu there is no configuration , but I already have installed C# extensions.
then I tried the solution View > Command Palette > Generate Asset for Build and debug…
I received this error "Unable to generate assets to build and debug. OmniSharp server is not running."
So any help please?
PS: Already downloaded the last version of mono because it was one of the solutions but didn’t work either.
asked Sep 7, 2019 at 12:13
Okay I fixed it.
- Full uninstalled VSCode ( I had to delete some manually)
- Installed Again
- Installed C# Extension
- Add a workspace [File > OpenFolder] (Important One)
- [View > Command Pallete… > .NET: Generate Assets for Debug and Build]
- DONE!! , Now you can see in Debug panel [Ctrl+Shift+D] Debug: .Net Core Launch(Console) , Instead of «No Configuration».
answered Sep 10, 2019 at 23:13
My Answer (Answer found on September 5, 2021) Tomorrow my Birthday
- Step one open Visual Studio Code
- Go to explorer or (Ctrl+Shift+E) to get there
- Open your folder that you created that you try to get Omnisharp into
- click on C# Program.cs, It should be the last one
- Then go to View (U can skip this step if u going to (Ctrl+Shift+P))
- Select Command Pattele or (Ctrl+Shift+P)
- From there it should bring up a Search bar
- Search for OmniSharp
- Select «OmniSharp: Restart Omnisharp»
- Then wait for it to restart or agree to it to restart then wait
- Now then if u try to add what u going to add it should work
Hope this helps
answered Sep 6, 2021 at 1:04