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.

Renaming file or creating new file breaks omnisharp lookup

See original GitHub issue

Environment data

dotnet --info output:

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

VS Code version:

Version 1.20.1 (1.20.1)

C# Extension version:

1.14.0

Steps to reproduce

Create a file or rename a file and wait for Omnisharp to parse the file.

Expected behavior

VSCode should be able to find all existing namespace and assemblies.

Actual behavior

VSCode failed to find interfaces in the same namespace, and we can only reproduce it in current session, restarting VSCode, the issue is gone.

It seems Omnisharp somehow couldn’t recognize new file or renamed file are in the same namespace.

Screenshots

Existing file:

screen shot 2018-02-15 at 14 48 51

Create a new file with simple class name change:

screen shot 2018-02-15 at 14 48 51

Problems:

screen shot 2018-02-15 at 14 49 18

Restart or reload VSCode:

screen shot 2018-02-15 at 14 55 07

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:38 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Shnagenburgcommented, Aug 5, 2018

I’ve run into this problem as well with VSCode + Unity and would love a fix. I can only get it to consistently work by closing and restarting VSCode every time I create a new file.

3reactions
Blackclawscommented, Jun 3, 2020

I have the same problem and I’m wondering why Omnisharp doesn’t simply add the file to a csproj that covers any file close by, this would at least work for creating files in the same directory as existing files.

Visual Studio is able to add files to an open Unity solution just fine. What is keeping omnisharp from doing the same? Or is this something that should happen on vscode project management level?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PSA for those writing C# in VSCode (all 10 of us): Omnisharp ...
But I often switch to VSCode because I like the project explorer/file hierarchy better + the significantly better plain text search.
Read more >
Can't get VSCode to work properly with Unity
C# Extension/omnisharp is not recognizing my files as .cs and when I installed another extension to create a cs file, it gave me...
Read more >
vs code Problems with C# extension, Some projects have ...
ProjectSystem No solution files found in '/Users/zeyad/Documents/Sandbox/CSharpTut' [info]: OmniSharp.MSBuild.ProjectManager Queue project ...
Read more >
Hidden features of OmniSharp and C# extension for VS Code
OmniSharp powers intellisense and language services in C# plugins and extensions for numerous ... If the file doesn't exist, just create it.
Read more >
April 2022 (version 1.67) - Visual Studio Code
Markdown: Rename headers. Ever change a header in a Markdown file only to realize that you also accidentally broke all links to it?...
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