question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Go to Definition not working

See original GitHub issue

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\sdk\1.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.0\bin\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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
AndyPookcommented, Jul 6, 2018

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

0reactions
RDavis3000commented, Aug 23, 2022

I had the same issue; I looked at the OmniSharp logs and found

OmniSharp server started with .NET 6.0.400
.
    Path: C:\Users\Richa\.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32-x64\.omnisharp\1.39.0-net6.0\OmniSharp.dll
    PID: 876

[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

For me the problem was that OmniSharp was trying to execute \OmniSharp.dll If you go to settings Omnisharp:path and put the full path to OmniSharp.exe it works. In your example @spy653 it would be : C:\Users\Richa.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32-x64.omnisharp\1.39.0-net6.0\OmniSharp.exe YMMV but hope it helps someone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode "go to definition" not working - Stack Overflow
The problem is in my case, with the angular language service extension. Install another version for instance v11.1.0 and it will work. ·...
Read more >
Fix: VS Code Go to Definition Not Working - YouTube
Visual Studio Code (VS Code) is a very popular code editor among the developers of the world. This is due to it's awesome...
Read more >
Go to definition not working · Issue #6854 - GitHub
"Go to definition" was working yesterday, but suddenly stop working. I tried to open my project in another computer using Ubuntu 20.04 and...
Read more >
Ctrl + Click go to definition not working. : r/vscode - Reddit
I had a the same issue: F12 and Ctrl + Click and Right Click "Go To Definition" wasn't working. The fix for me...
Read more >
Visual Studio 2019 F12 Goto definition not working with ...
When I press F12 on the CallMethodAction MethodName (BtnLoginClick) it says "cannot navigate to definition" If I press F12 on the Content ( ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found