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

C# not working, Omnisharp not starting #3640

Closed
ghost opened this issue Mar 8, 2020 · 13 comments
Closed

C# not working, Omnisharp not starting #3640

ghost opened this issue Mar 8, 2020 · 13 comments

Comments

@ghost
Copy link

ghost commented Mar 8, 2020

Issue Description

C# Intellisense not working. All of the C#, .NET, and Omnisharp logs are empty, and the Omnisharp icon not showing in the status bar

I tried removing .omnisharp and .vscode folders, turned off my firewall. But, no success

Steps to Reproduce

  1. Launch VS code
  2. Installing C# extension manually (.vsix file) (tried 1.21.13 1.21.12 1.21.11 all with the same result)
  3. C# log will show packages downloading, and after finishing the installing the packages the "Installing packages" icon will still be shown in the status bar, Omnisharp won't start
  4. Close and re-open VS code
  5. C#, Omnisharp, and .NET logs will all be empty. No Intellisense, and Omnisharp not starting

Expected Behavior

Omnisharp starting, and C# Intellisense working normally

Actual Behavior

Omnisharp not starting, C# Intellisense not working

Logs

Razor Log:

Razor.VSCode version 1.0.0-alpha3-5.0.0-preview.2.20120.8

Razor's trace level is currently set to 'Off'

  • To change Razor's trace level set 'razor.trace' to 'Off', 'Messages' or 'Verbose' and then restart VSCode.
  • To report issues invoke the 'Report a Razor issue' command via the command palette.

[Client - 8:52:38 AM] No Razor files detected in workspace, delaying language server start.

OmniSharp log

EMPTY, literally there is nothing in the Omnisharp log

C# log

First time after installing the extension:
Installing C# dependencies...
Platform: win32, x86_64

Downloading package 'OmniSharp for Windows (.NET 4.6 / x64)' (32544 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Windows (.NET 4.6 / x64)'

Downloading package '.NET Core Debugger (Windows / x64)' (41930 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (Windows / x64)'

Downloading package 'Razor Language Server (Windows / x64)' (50586 KB).................... Done!
Installing package 'Razor Language Server (Windows / x64)'

Finished

Other times:
Same as the Omnisharp log

Environment information

VSCode version: 1.42.1
C# Extension: 1.21.13

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33

.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.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.21.13
@pmilkowski
Copy link

What worked for me:

  1. F1 -> Open Settings(JSON)
  2. Find the "[csharp]" key
  3. Set the value of "editor.defaultFormatter" to "ms-dotnettools.csharp"

@cartermp
Copy link

Thanks for the report. Can you confirm that you have a C# file open when seeing this issue? Mentioning that IntelliSense failed to work sounds like it, but we don't want to assume anything here.

@ghost
Copy link
Author

ghost commented Mar 11, 2020

Thanks for the report. Can you confirm that you have a C# file open when seeing this issue? Mentioning that IntelliSense failed to work sounds like it, but we don't want to assume anything here.

Yes I do

@ghost
Copy link
Author

ghost commented Mar 11, 2020

What worked for me:

  1. F1 -> Open Settings(JSON)
  2. Find the "[csharp]" key
  3. Set the value of "editor.defaultFormatter" to "ms-dotnettools.csharp"

No such option exists in my Settings.JSON file however there was one in the defaultsettings.JSON but I couldn't modify any of the settings in the default settings file

@nigelmcdonald
Copy link

nigelmcdonald commented Mar 14, 2020

I have the same problem, where no problems are discovered when there definately are problems and omni log is completely empty
I tried adding "editor.defaultFormatter": "ms-dotnettools.csharp" after "[csharp]": {}, but this also hasn't helped

Fresh install of vscode version 1.42
Extensions:
C# vs 1.21.14

@demidimi
Copy link

Same issue here too...

@demidimi
Copy link

Somewhat fixed my problem by uninstalling and reinstalling omnisharp.
now the server starts and finds errors but finds them at "off" places. (display error in the next line of where the error is/ if the error is at beginning of the line it displays the squiggly line at the end of the line)

@demidimi
Copy link

Omnisharp starts if I open VSCode directly (outside of unity)
however, it does not stat is Unity starts VSCode...

@JoeRobich
Copy link
Member

@demidimi Thanks for that bit of information. Indeed opening a c# file from Unity does not open the folder containing the scripts but simply opens a file individually. The C# extension needs a folder to be open in order to find a .csproj or .sln file that provides additional details required to have a functional workspace.

image

@JoeRobich
Copy link
Member

Reported this issue via Unity "Report a Bug" functionality. Closing as Unity is opening us in an incomplete manner.

@EthanVanderHorn
Copy link

@JoeRobich I have this exact problem as Ghost described, even when launching VS Code directly and opening a folder. VSCode shows my folder where your screen shot says "NO FOLDER OPEN".

Just like Ghost described, all logs are completely empty.
I tried the fix as pmilkowski described and it didn't change anything.
I tried disabling and reinstalling all my extensions.
I tried a fresh install of VS Code.
I tried deleting my .VSCode folder in my repo. It does not get regenerated.

@hanhsia
Copy link

hanhsia commented Apr 12, 2021

I have the same issue. Omnishar server started properly if i open a folder which contains c# code using vs code. But if i just open a workspace, it can't trigger the server start. Does it mean C# extension doesn't support Workspace?

@thahseen21
Copy link

I solved it by selecting the appropriate solution
image

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

No branches or pull requests

8 participants