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

Intellisense doesn't work for referenced projects in .net core outside of project directory #2445

Closed
rich-ware opened this issue Jul 31, 2018 · 9 comments

Comments

@rich-ware
Copy link

Environment data

dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.302
Commit: 9048955601

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

Host (useful for support):
Version: 2.1.2
Commit: 811c3ce6c0

.NET Core SDKs installed:
1.1.9 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.302 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

VS Code version: 1.25.1
C# Extension version: 1.15.2

Steps to reproduce

Reference a project outside of current folder of a project.

Expected behavior

The intellisense will NOT show red squiggly lines for all references. Including Microsoft references.

Actual behavior

The intellisense shows red squiggly lines for all references. This includes Microsoft references.

@rchande rchande added the Bug label Aug 7, 2018
@rchande
Copy link

rchande commented Aug 9, 2018

@rich-ware I'm having trouble reproducing this with small test projects. Could you share your omnisharp log and a more specific description of your directory structure?

@goobering
Copy link

+1. VS Code is unusable for C# with Omnisharp in its current state on my machine - red squigglies everywhere, accompanied by the popup error:

There are unresolved dependencies from '[MyProjectName\MyProjectName].csproj'. Please execute the restore command to continue.

Executing dotnet restore , dotnet build, dotnet run from the terminal works as expected, but the editor's completely borked.

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.302
 Commit:    9048955601

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.302/

Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0

.NET Core SDKs installed:
  2.1.4 [/usr/share/dotnet/sdk]
  2.1.302 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

I'd love to share the full log I get when I restart Omnisharp in VS Code but it's 10608 lines. This is everything to the first *** Request*** line:

Starting OmniSharp server at 8/14/2018, 2:49:50 PM
    Target: c:\Users\[username]\source\repos\RazorPagesMovie\RazorPagesMovie.sln

OmniSharp server started
    Path: C:\Users\[username]\.vscode-insiders\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.30.1\OmniSharp.exe
    PID: 11572

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Community 2017 15.7.27703.2047 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
            2: StandAlone 15.0 - "C:\Users\[username]\.vscode-insiders\extensions\ms-vscode.csharp-1.15.2\.omnisharp\1.30.1\msbuild\15.0\Bin"
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Utilities.Core' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Tasks.Core' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Framework' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Community 2017 15.7.27703.2047 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Utilities.Core' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Framework' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Users\[username]\source\repos\RazorPagesMovie'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in c:\Users\[username]\source\repos\RazorPagesMovie
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.dll'
[dbug]: OmniSharp.MSBuild.ProjectSystem
        MSBuild environment: 
Mode: VisualStudio
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
MSBuildToolsDirectory64: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64
MSBuildSDKsPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks
CurrentMSBuildConfigurationFile: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe.config
CurrentMSBuildExePath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
CurrentMSBuildToolsDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
VisualStudioInstallRootDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
MSBuildExtensionsPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild

[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in 'c:\Users\[username]\source\repos\RazorPagesMovie\RazorPagesMovie.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Users\[username]\source\repos\RazorPagesMovie\RazorPagesMovie\RazorPagesMovie.csproj'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Users\[username]\source\repos\RazorPagesMovie'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Users\[username]\source\repos\RazorPagesMovie\RazorPagesMovie\RazorPagesMovie.csproj
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.dll'
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Users\[username]\source\repos\RazorPagesMovie' on host 9916.
[dbug]: OmniSharp.Stdio.Host

@rchande
Copy link

rchande commented Aug 14, 2018

@goobering it looks like you ran your dotnet --info command from inside a WSL prompt or something--your OS is listed as Ubuntu but your logs contains Windows file paths.
Can you confirm that you're able to build the project from a Windows terminal?
Also your installed Visual Studio (which OmniSharp will use MSBuild from) is a bit out of date--could you try updating that?

@goobering
Copy link

goobering commented Aug 14, 2018

I did indeed run dotnet --info from inside a WSL prompt inside VS Code. I can confirm that the project also restores/builds/runs from a Windows Command Prompt terminal in the same instance of VS Code that I ran the WSL terminal in. Per my initial comment, dotnet commands appear to be working correctly in both terminal variants - it's the editor that's stuffed.

VS Community 2017 is reporting that it's at 15.7.6, last update 6th August 2018, no updates pending. I'm open to suggestions if you have a link to something more up to date?

@rchande
Copy link

rchande commented Aug 14, 2018

@goobering Do you have VB projects in your solution? I'm looking at the

[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

That appear in your log. That's not something I've seen before.

@goobering
Copy link

Certainly not on purpose - that particular project was me screwing around with the Razor Pages tutorial here. I didn't create any VB content.

It doesn't seem to make any difference what the project structure is - I can start a fresh, empty project and achieve the same results, i.e. the dotnet tooling behaves as normal, but the editor reports that it can't find any external namespaces.

@goobering
Copy link

If it helps at all, it looks to me that I'm having extremely similar issues to those described in 2147 and 2295. I have already tried setting the Omnisharp version to 'latest' and restarting for the update, but with no success.

@goobering
Copy link

Deep joy. I followed this report, ran sudo apt-get remove mono-devel from my WSL terminal, and I'm back in business. No more red squigglies. @rich-ware - does this have any effect on your system?

@cartermp cartermp removed the Bug label Sep 22, 2020
@cartermp
Copy link

The root issue appears to be resolved.

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

4 participants