Omnisharp-vscode: Not getting good intellisense, navigation, etc..

Created on 7 Feb 2017  Â·  4Comments  Â·  Source: OmniSharp/omnisharp-vscode

Environment data

VSCode 1.9.0
C# Extension version 1.6.2

dotnet --info 
.NET Command Line Tools (1.0.0-rc4-004769)

Product Information:
 Version:            1.0.0-rc4-004769
 Commit SHA-1 hash:  9cf4e9d1d0

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15021
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0-rc4-004769

Steps to reproduce

I suspect that it's got something to do with the way that I've built my csproj files (it builds/compiles/tests just fine) but I can't seem to get any actual editor awareness of my project

You can see my project/branch: https://github.com/Azure/autorest/tree/coreclr

or clone that branch:

#check out the project & branch
git clone https://github.com/azure/autorest --branch coreclr --single-branch autorest 
cd autorest

# we use gulp at build time, so if you try to build from vscode, you need some node modules.
npm install 

I have some common .proj files that I import in the .csproj files that define common things (like $(SolutionDir) )

In my projects, I reference other projects like this:

 <ItemGroup>
    <ProjectReference Include="$(SolutionDir)src/core/AutoRest.Core/AutoRest.Core.csproj" />
    <ProjectReference Include="$(SolutionDir)src/core/AutoRest.Extensions/AutoRest.Extensions.csproj" />
    <ProjectReference Include="$(SolutionDir)src/modeler/AutoRest.Swagger/AutoRest.Swagger.csproj" />
  </ItemGroup>

where $(SolutionDir) was set to

<SolutionDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),AutoRest.sln))/</SolutionDir> 

and I've also tried this:

<Common>$(MsBuildThisFileDirectory)</Common>
<SolutionDir>$(Common)../../</SolutionDir>

Actual behavior

The c# extension reaally hates that. It doesn't give any errors, but I get unresolvable namespaces when I reference projects using $(SolutionDir)
image

if I change the all references to relative paths without variables...

 <ItemGroup>
    <ProjectReference Include="../../../src/core/AutoRest.Core/AutoRest.Core.csproj" />
    <ProjectReference Include="../../../src/core/AutoRest.Extensions/AutoRest.Extensions.csproj" />
    <ProjectReference Include="../../../src/modeler/AutoRest.Swagger/AutoRest.Swagger.csproj" />
  </ItemGroup>

I still get the squiggleys. 😞

Hmm.

I even see this in the project that doesn't have any project dependencies (Autorest.Core), so ... not sure why we're seeing :

image

Those are all references inside that single project.

The OmniSharp Log output window:

Starting OmniSharp server at 2/7/2017, 8:23:04 AM
    Target: c:\work\github\autorest-coreclr\AutoRest.sln

OmniSharp server started
    Path: C:\Users\garre\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\OmniSharp.exe
    PID: 31004

OmniSharp: -s c:\work\github\autorest-coreclr\AutoRest.sln --hostPID 6652 --stdio DotNet:enablePackageRestore=false --encoding utf-8 formattingOptions:useTabs=false formattingOptions:tabSize=2 formattingOptions:indentationSize=2
[INFORMATION:OmniSharp.Startup] Omnisharp server running using Stdio at location 'c:\work\github\autorest-coreclr' on host 6652.
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in c:\work\github\autorest-coreclr
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp#MSBuild] MSBUILD_EXE_PATH environment variable set to C:\Users\garre\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\msbuild\MSBuild.exe
[INFORMATION:OmniSharp#MSBuild] MSBuildExtensionsPath environment variable set to C:\Users\garre\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\msbuild
[INFORMATION:OmniSharp#MSBuild] MSBuildSDKsPath environment variable set to C:\Users\garre\.vscode\extensions\ms-vscode.csharp-1.6.2\bin\omnisharp\msbuild\Sdks
[INFORMATION:OmniSharp#MSBuild] Detecting projects in 'c:\work\github\autorest-coreclr\AutoRest.sln'.
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest\AutoRest.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest\AutoRest.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest.Core\AutoRest.Core.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest.Core\AutoRest.Core.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest.Core.Tests\AutoRest.Core.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest.Core.Tests\AutoRest.Core.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions\AutoRest.Extensions.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions\AutoRest.Extensions.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions.Azure\AutoRest.Extensions.Azure.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions.Azure\AutoRest.Extensions.Azure.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions.Azure.Tests\AutoRest.Extensions.Azure.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions.Azure.Tests\AutoRest.Extensions.Azure.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions.Tests\AutoRest.Extensions.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\core\AutoRest.Extensions.Tests\AutoRest.Extensions.Tests.csproj
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'Core'
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'Generator'
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'Modeler'
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.AzureResourceSchema\AutoRest.AzureResourceSchema.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.AzureResourceSchema\AutoRest.AzureResourceSchema.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.AzureResourceSchema.Tests\AutoRest.AzureResourceSchema.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.AzureResourceSchema.Tests\AutoRest.AzureResourceSchema.Tests.csproj
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'Dev'
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\dev\AutoRest.Tooling.CSharp.Compiler\AutoRest.Tooling.CSharp.Compiler.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\dev\AutoRest.Tooling.CSharp.Compiler\AutoRest.Tooling.CSharp.Compiler.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\modeler\AutoRest.CompositeSwagger\AutoRest.CompositeSwagger.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\modeler\AutoRest.CompositeSwagger\AutoRest.CompositeSwagger.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\modeler\AutoRest.CompositeSwagger.Tests\AutoRest.CompositeSwagger.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\modeler\AutoRest.CompositeSwagger.Tests\AutoRest.CompositeSwagger.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\modeler\AutoRest.Swagger\AutoRest.Swagger.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\modeler\AutoRest.Swagger\AutoRest.Swagger.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\modeler\AutoRest.Swagger.Tests\AutoRest.Swagger.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\modeler\AutoRest.Swagger.Tests\AutoRest.Swagger.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp\AutoRest.CSharp.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp\AutoRest.CSharp.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure\AutoRest.CSharp.Azure.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure\AutoRest.CSharp.Azure.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure.Fluent\AutoRest.CSharp.Azure.Fluent.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure.Fluent\AutoRest.CSharp.Azure.Fluent.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure.Fluent.Tests\AutoRest.CSharp.Azure.Fluent.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure.Fluent.Tests\AutoRest.CSharp.Azure.Fluent.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure.Tests\AutoRest.CSharp.Azure.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Azure.Tests\AutoRest.CSharp.Azure.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Tests\AutoRest.CSharp.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Tests\AutoRest.CSharp.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Unit.Tests\AutoRest.CSharp.Unit.Tests.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.CSharp.Unit.Tests\AutoRest.CSharp.Unit.Tests.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Go\AutoRest.Go.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Go\AutoRest.Go.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Java\AutoRest.Java.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Java\AutoRest.Java.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Java.Azure\AutoRest.Java.Azure.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Java.Azure\AutoRest.Java.Azure.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Java.Azure.Fluent\AutoRest.Java.Azure.Fluent.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Java.Azure.Fluent\AutoRest.Java.Azure.Fluent.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.NodeJS\AutoRest.NodeJS.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.NodeJS\AutoRest.NodeJS.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.NodeJS.Azure\AutoRest.NodeJS.Azure.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.NodeJS.Azure\AutoRest.NodeJS.Azure.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Python\AutoRest.Python.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Python\AutoRest.Python.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Python.Azure\AutoRest.Python.Azure.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Python.Azure\AutoRest.Python.Azure.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Ruby\AutoRest.Ruby.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Ruby\AutoRest.Ruby.csproj
[INFORMATION:OmniSharp#MSBuild] Loading project from 'c:\work\github\autorest-coreclr\src\generator\AutoRest.Ruby.Azure\AutoRest.Ruby.Azure.csproj'.
[INFORMATION:OmniSharp#MSBuild] Add project: c:\work\github\autorest-coreclr\src\generator\AutoRest.Ruby.Azure\AutoRest.Ruby.Azure.csproj
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Core
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Core.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Extensions
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Extensions.Azure
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Extensions.Azure.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Extensions.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.AzureResourceSchema
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.AzureResourceSchema.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Tooling.CSharp.Compiler
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CompositeSwagger
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CompositeSwagger.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Swagger
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Swagger.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp.Azure
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp.Azure.Fluent
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp.Azure.Fluent.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp.Azure.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.CSharp.Unit.Tests
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Go
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Java
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Java.Azure
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Java.Azure.Fluent
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.NodeJS
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.NodeJS.Azure
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Python
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Python.Azure
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Ruby
[INFORMATION:OmniSharp#MSBuild] Update project: AutoRest.Ruby.Azure
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Detecting CSX files in 'c:\work\github\autorest-coreclr'.
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Configuration finished.
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: Object reference not set to an instance of an object.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /gotoDefinition: 500 30ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: Object reference not set to an instance of an object.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /gotoDefinition: 500 1ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: Object reference not set to an instance of an object.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /gotoDefinition: 500 0ms
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: Object reference not set to an instance of an object.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /gotoDefinition: 500 1ms

(those exceptions happened when I first typed in a source window)

Expected behavior

I would have hoped that it would be able to give me navigation and intellisense for my project ⛑

This is kindof a blocking issue for us; I can't migrate a bunch of developers over to dotnet-cli & vscode without this working

Most helpful comment

Oh sweet mercy, that's VERY MUCH BETTER!

All 4 comments

Hi, could you try the latest beta of C# for VS Code? This should have much better support for .csproj-based .NET Core projects. Please use our Installing Beta Releases instructions to install the latest beta (currently 1.7.0-beta4).

I will take a look at cloning this project and giving it a whirl. But in the short term, please try the beta and let me know if it works any better for you.

I'll try that right now

Oh sweet mercy, that's VERY MUCH BETTER!

I'm very glad to hear that!

Was this page helpful?
0 / 5 - 0 ratings