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# Suggestions Stopped Working #2525

Closed
fastfilm opened this issue Sep 13, 2018 · 10 comments
Closed

C# Suggestions Stopped Working #2525

fastfilm opened this issue Sep 13, 2018 · 10 comments
Assignees

Comments

@fastfilm
Copy link

fastfilm commented Sep 13, 2018

Environment data

dotnet --info output:
.NET Command Line Tools (2.0.2)

Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512

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

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version:
Version: 1.27.1 (system setup)
Commit: 5944e81f3c46a3938a82c701f96d7a59b074cfdc
Date: 2018-09-06T09:21:18.328Z
Electron: 2.0.7
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

C# Extension version:
1.16

Steps to reproduce

Create a .cs file, using System; Make a string variable, try to use "intellisense", i.e. auto-complete suggestions by typing ctrl-space.
It was working before now it doesn't. I updated VS Code so perhaps that had something to do with it.
image
.csproj file contains this:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp2.0</TargetFramework>
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Include="Newtonsoft.Json" Version="11.0.2"/>
      </ItemGroup>
    </Project>

It also doesn't suggest anything for methods on my own classes.

Expected behavior

Should suggest methods on string, like "Replace".

Actual behavior

minimal suggestion of "region" (doesn't seem like a useful suggestion either).

@akshita31
Copy link
Contributor

@fastfilm Can you post the output from "C#" and "OmniSharp log" from View--> Output window ?

@fastfilm
Copy link
Author

Sorry, I'm no VS Code expert, I don't know how to generate "output from C# and Omnisharp log". I can open the View --> Output window and it is blank. I can open the Developer tools, and I see this:
image

@fastfilm
Copy link
Author

Ah, I found the Omnisharp log.
image
Can't find a C# log -- here are my options on the right-hand menu drop-down:
image

@akshita31
Copy link
Contributor

Ok so the problem here is that the omnisharp server could not start for you. Can you uninstall and reinstall the extension ? And when you reload vscode for the first time after installing the extension , you might find a c# log.

@fastfilm
Copy link
Author

I tried uninstalling the extension once before. Recently I tried uninstalling VSCode and re-installing it. Just now I tried uninstalling and re-installing the extension. The logs appear the same -- the Omnisharp log shows the same error, and there is no option to view a C# log.

@akshita31
Copy link
Contributor

Can you delete the "install.Lock" file and ".omnisharp" folder in the ".vscode/extensions/msvscode.csharp-1.16.0" folder and then restart vscode ?

@akshita31 akshita31 self-assigned this Sep 13, 2018
@fastfilm
Copy link
Author

Hi Akshita -- After a bit of searching, I found the .vscode folder you were talking about. At first, I thought you meant the .vscode folder in the project, but there wasn't much there. So I poked around and find one under Users. I removed the file and folder you mentioned. I then re-started VS Code. There is now a C# log:
image
And here is the Omnisharp log:
image
Thanks for looking into this.

@akshita31
Copy link
Contributor

akshita31 commented Sep 14, 2018

@fastfilm This suggests that omnisharp is downloaded successfully but some how there is a problem with starting the process. Can you try adding C:\Windows\System32\ to your system path variables and then restarting vscode ?

@fastfilm
Copy link
Author

That was the problem. My path recently got stomped on by something (not 100% certain who the guilty party is). Of course I didn't have a backup of it, so I didn't know what was in it. Apparently, Windows\System32 was part of it. How did you suspect that might be the issue?
Thanks, hope this might help someone else as well. Perhaps the path requirement should be documented somewhere, though I'm not certain where.

@akshita31
Copy link
Contributor

@fastfilm Gald you got it working. This is not a common error with omnisharp so I searched stack overflow for for "spawn cmd ENOENT" and got that suggestion there.

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

2 participants