-
Notifications
You must be signed in to change notification settings - Fork 676
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
xproj ignored. CodeLens don't show References, Find All References don't work #962
Comments
It's 100% expected that xproj is ignored. xproj doesn't actually have any significant information about your projects. That information is all in the project.json. So, the real concern is that it doesn't find any project.json files in your log. I have a couple of questions:
|
I created a .NET Core Web Application in Visual Studio 2015 using the latest .NET Core tools for Visual Studio and the .NET Core CLI available at https://dot.net and it worked fine:
|
From your screenshots, it looks like you are using a different project rather than what you described in the repro steps. Could you provide a project that reproduces this issue? |
I created a new project, because I removed the previous project files. It is slightly different in structure, but the meaning is the same. screenshotsolutionLogStarting OmniSharp server at 21.11.2016, 23:07:22 OmniSharp server started OmniSharp: -s c:\NewProject\New\LombardServiceNew --hostPID 3748 --stdio DotNet:enablePackageRestore=false --encoding utf-8 dotnet info.NET Command Line Tools (1.0.0-preview2-1-003177) Product Information: Runtime Environment: |
also it don't work with dotnet --info.NET Command Line Tools (1.0.0-preview3-003805) Product Information: Runtime Environment: |
It looks like you restructured your project and deleted the global.json. That defines search paths used to locate your projects when project.json is used. Without that, VS Code won't be able to process your projects. https://docs.microsoft.com/dotnet/articles/core/tools/global-json. Note that ASP.NET Core applications really like to be in a particular directory structure. WRT |
Just forgot to create a global.json. But I've added it to the folder with the solution. Nothing has changed - codeLens is not working. |
Added
but it did not help |
What is the way for me to get more information from OmniSharp, and try to dig deeper ? |
@valery-shinkevich: I haven't dug too deeply yet, but it appears to me that the issue has to do with folder depth. If I use your structure, it fails to find the project.json files. However, if I use the "src" and "test" folders that are created for me by the project template in VS 2015, it works fine. |
From reading the code in OmniSharp, I think I see where the bug is. I'm looking at this code: https://github.com/OmniSharp/omnisharp-roslyn/blob/dev/src/OmniSharp.DotNet/Projects/ProjectSearcher.cs#L76-L83 return globalSettings.ProjectSearchPaths
.Select(searchPath => Path.Combine(globalSettings.DirectoryPath, searchPath))
.Where(actualPath => Directory.Exists(actualPath))
.SelectMany(actualPath => Directory.GetDirectories(actualPath))
.Where(actualPath => File.Exists(Path.Combine(actualPath, Project.FileName)))
.Select(path => Path.GetFullPath(path))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList(); It looks to me like the |
Note that there's a bit of information that might be helpful here on StackOverflow: http://stackoverflow.com/questions/34791682/explanation-of-the-projects-section-in-global-json-in-asp-net-5 |
Yeah, I just debugged through OmniSharp and that's definitely where the failure is. |
For now, if you put your projects in the expected directory structure it will work. We should be able to address this in the next release of the C# extension. |
It turns out that this issue and #904 have the same root cause. Linking them... |
This is fixed in OmniSharp now. Once we take a new build for the extension, we'll publish a beta that you can try. Otherwise, the fix will be available when we ship 1.6 of the extension in the coming weeks. |
I've created a v1.6-beta2 release of the C# extension that contains this fix, among others. See this page for information on installing beta releases |
Thank you. I just now saw your post. Everything is working! References displays as it should! |
Glad to hear it! |
Environment data
dotnet --info
output:.NET Command Line Tools (1.0.0-preview3-003805)
Product Information:
Version: 1.0.0-preview3-003805
Commit SHA-1 hash: edf2fc1f53
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
VS Code version:
1.7.1
C# Extension version:
1.5.2
Steps to reproduce
Create solution with VS 2015 (with last Core updates).
Works fine.
Open solution folder in VSCode - CodeLens don't show References, Find All References don't work.
https://cloud.githubusercontent.com/assets/1697801/20385121/31689772-acc7-11e6-965a-3f00b0e07869.jpg
OmniSharp log
Starting OmniSharp server at 18.11.2016, 12:03:36
Target: c:\NewProject\New\LombardService
OmniSharp server started
Path: C:\Users\WaSh.vscode\extensions\ms-vscode.csharp-1.5.2\bin\omnisharp\OmniSharp.exe
PID: 7108
OmniSharp: -s c:\NewProject\New\LombardService --hostPID 11100 --stdio DotNet:enablePackageRestore=false --encoding utf-8
[INFORMATION:OmniSharp.Startup] Omnisharp server running using Stdio at location 'c:\NewProject\New\LombardService' on host 11100.
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in c:\NewProject\New\LombardService
[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] Detecting projects in 'c:\NewProject\New\LombardService\LombardServiceNew.sln'.
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'src\LombardService.Data\LombardService.Data.xproj'
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'src\LombardService.Services\LombardService.Services.xproj'
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'tests\LombardService.Services.Tests\LombardService.Services.Tests.xproj'
[INFORMATION:OmniSharp.Startup] Configuration finished.
The text was updated successfully, but these errors were encountered: