Omnisharp-vscode: Go to Definition not working

Created on 3 May 2017  ·  13Comments  ·  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.3)
Product Information:
Version: 1.0.3
Commit SHA-1 hash: 37224c9917
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk1.0.3

VS Code version: 1.11.2
C# Extension version: 1.9.0

Steps to reproduce

  1. visual studio code open a folder that containstodoApi.csproj and some *.cs files
  2. open a .cs file and right click a class, "got to definition" appeared, but it does not work. and wait a minute "go to definition" disappered.

Expected behavior

"go to definition" work well

Actual behavior

"go to definition" does not work

omnisharp log:

Starting OmniSharp server at 2017/5/3 上午11:37:28
Target: e:\Visual Studio Code\DotNetCore\todoApi
OmniSharp server started
Path: C:\Users\user.vscode\extensions\ms-vscode.csharp-1.9.0bin\omnisharp\OmniSharp.exe
PID: 8820
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

Visual Studio 2010 Installed

Resolved-External

Most helpful comment

Just in case it helps anyone...
There may be multiple "projects" in the folder and VSCode has selected the "wrong" one.

Use ctrl-shift-P and select "OmniSharp: Select Project" to select the correct project (a .sln file).

If you have the Output window open with "OmniSharp Logs" selected, you will see it reading your csproj's. Once finished your goto definition will start to work

All 13 comments

Is that your full OmniSharp log?

@DustinCampbell Yes, I followed the following steps, selecting View->Output in VS Code. Then, click the combobox at the top-right of the Output pane and choose "OmniSharp Log".

Sorry for the delay. Are you able to run the following at a command prompt?

C:\Users\user.vscode\extensions\ms-vscode.csharp-1.9.0\bin\omnisharp\OmniSharp.exe -s "e:\Visual Studio Code\DotNetCore\todoApi" --stdio

If so, could you share the output here?

Note: This looks a lot like #1448

Thanks @DustinCampbell . when I run the command at a command prompt,a windows exception exists.


OmniSharp.exe - .NET Framework Initialization Error
To run this application, you first must install one of the following versions of the .NET Framework:
.NETFramework,Version=v4.6

Would you like to download and install .NETFramework,Version=v4.6 now?

Does it mean OmniSharp depend on .NETFramework 4.6? Whether the .NETFramework 4.6 package must be installed ? Now .NETFramework 4.0 is installed on my computer.

Yes. OmniSharp requires at least .NET Framework 4.6 to run.

Thanks

Did installing 4.6 work for you?

@DustinCampbell .Thank you for your concern. My Development Environment does not allow me to install .NET Framework 4.6. So there is no answer now.

Just in case it helps anyone...
There may be multiple "projects" in the folder and VSCode has selected the "wrong" one.

Use ctrl-shift-P and select "OmniSharp: Select Project" to select the correct project (a .sln file).

If you have the Output window open with "OmniSharp Logs" selected, you will see it reading your csproj's. Once finished your goto definition will start to work

@AndyPook I get this:

command 'o.restart' not found
command 'o.pickProjectAndStart' not found

@sgentile Can you file a new issue and include in it:
the output of dotnet --version
your VS Code version
your C# extension version

Sorry @sgentile, looks like you did that already. Thanks.

Was this page helpful?
0 / 5 - 0 ratings