-
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
C# Extension fails only for netcoreapp3.0 GA #3289
Comments
what is the content of your csproj file? the warning says that you have 'Microsoft.NETCore.App' there which is not needed in 3.0. also can you please set omnisharp.logginglevel to "debug" and post the output again? |
I found the same issue on OSX on a I followed the steps above for comparison. I additionally added the debug flag. OmniSharp logStarting OmniSharp server at 9/23/2019, 10:57:18 PM OmniSharp server started with Mono 5.18.1. Starting OmniSharp on MacOS 10.14.6 (x64) OmniSharp Log (-debug)
Starting OmniSharp server at 9/23/2019, 11:07:49 PM
Target: /Users/macuser/code/OmniDemo
OmniSharp server started with Mono 5.18.1. Loaded OmniSharp.Cake, Version=1.34.0.0, Culture=neutral, PublicKeyToken=null 'CscToolPath' set to '/Users/macuser/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/Roslyn' C# logNONE
Environment informationVSCode version: 1.38.1 Mono InformationOmniSharp using global mono :5.18.1Dotnet Information.NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26Runtime Environment: Host (useful for support): .NET Core SDKs installed: .NET Core runtimes installed: To install additional .NET Core runtimes or SDKs: Visual Studio Code Extensions
|
I have the same issue both on Windows 10 Enterprise Edition and Fedora 30. Both environments are updated and the latest versions of VSCode, C# Extension and .Net Core SDK are installed. Please see below the logs from my Fedora 30 machine: LogsOmniSharp log
Starting OmniSharp server at 24/09/2019, 06:01:13
Target: /media/workspace/Projects/Temp/DemoApp
OmniSharp server started. Starting OmniSharp on fedora 30.0 (x64) C# logTask - Build log
> Executing task: dotnet build /media/workspace/Projects/Temp/DemoApp/DemoApp.csproj /property:GenerateFullPaths=true <
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core Restore completed in 14.38 ms for /media/workspace/Projects/Temp/DemoApp/DemoApp.csproj. Build succeeded. Time Elapsed 00:00:00.86 Terminal will be reused by tasks, press any key to close it. Environment informationVSCode version: 1.38.1 Mono InformationOmniSharp using built-in monoDotnet Information.NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26Runtime Environment: Host (useful for support): .NET Core SDKs installed: .NET Core runtimes installed: To install additional .NET Core runtimes or SDKs: Visual Studio Code Extensions
It might help if I add that everytime I open a netcoreapp3.0 application, C# extension keeps showing the following message: "There are unresolved dependencies. Please execute the restore command to continue." Any help would be highly appreciated. |
Please see below as the content of my csproj file:
|
I would really like to help but I can't reproduce this on any system 😀 The warning I will continue to look into this but it would be great to get any more info from anyone experiencing this. |
I looked in folder "/home/masoud/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/" to see if I have MSBuild version 16 there. I checked the MSBuild.dll.config file and the contents of this file looks wrong.
It looks like the MSBuild located in the path that C# extension is referencing it is version 15 not 16? Thanks. |
It is version 16, however MsBuild 16 has assembly version 15.1. |
I see! Thanks :) |
If you are on Linux or MacOS you may want to try install Mono 6.0.0 https://www.mono-project.com/download/stable/ |
Thank you. File contentsOmniDemo.csprojProgram.cs |
No, the built in MsBuild is given preference over Visual Studio 2017. |
And I checked: No VS 2019 installed, nor previews. |
can you also post the contents of the |
Sure, and screenshot of VS Code - coming up in a moment - - - |
I have the same issue both on Windows 10. Both environments are updated and the latest versions of VSCode, C# Extension and .Net Core SDK are installed. VSCode version: 1.38.1 C# Extension: 1.21.3 Net Core: 3.0 |
I have the same issue on Windows 10. I use the new version OmniSharp logStarting OmniSharp server at 2019/9/24 下午2:42:34
Target: d:\sandbox\console3
OmniSharp server started. Starting OmniSharp on Windows 6.2.9200.0 (x64) C# logPost the output from Output-->C# here
Environment informationVSCode version: 1.38.1 Dotnet Information.NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26Runtime Environment: Host (useful for support): .NET Core SDKs installed: .NET Core runtimes installed: To install additional .NET Core runtimes or SDKs: Visual Studio Code Extensions
|
if you are Windows, I believe the workaround will be to install Visual Studio 2019 (latest - 16.3) https://visualstudio.microsoft.com/vs/ |
OK, will do. Right now checking MSBuild's in my path. |
Really! I goes to updated my VS 2019, and all problem are fixed. |
Thanks a lot for confirming 👍 If anyone experiences this problem on *nix platforms I believer this should help too #3289 (comment) OmniSharp ships with an embedded MSBuild which for various reasons is somewhat limited - it should work however for more basic scenarios like shown here. If we find VS2019 (Windows) or Mono 5.18.1+ (Linux, MacOS) on the machine, we use that instead. We are investigating how we can bring the embedded MSBuild up to speed here and what goes wrong there. |
I'll give this a go once I'm back home. |
I'm experiencing the same issue on Ubuntu 18.04.
But I open in vscode 1.38.1 with ms-vscode.csharp extension version 1.21.3 I get the same warning as other people in the OmniSharp Log:
I also get unresolved dependencies asking me to restore and intellisense not working with lots of errors similar to the following one:
Installing mono-devel from Mono 6.0.0 Stable (https://www.mono-project.com/download/stable/) fixed the issue, but it needs another 365 MB disk space. |
Still not working on my Windows 10 even with VS19 installed. Please see the OmniSharp log below:
|
AND - Install VS 2019 Community edition solved issue on my laptop as well. |
Just a note that if I uninstalled dotnet-sdk-2.2 (so that I only have dotnet-sdk-3.0 installed) I get a different error in the OmniSharp Log:
I could then fix the issue by making omnisharp use the legacy SDK resolver as mentioned in #3160 (comment) |
I think, that best way to solve the problem is to wait till OmniSharp will roll-out the uppdate for their extension with standalone 16.0+ msbuild package. As for me, I see, that extension uses this one: |
This is my OmniSharp log after uninstalling all other .net core sdks and only having version 3 installed:
|
you could try adding
and see if it helps |
Thanks. It helped! |
Guys, I've got the solution (for those, who don't want to install VS2019).
After it I get this output:
So correct version of MSBuild is now used by OmniSharp. But don't forget about step 3, solution need .Net Core 3.0 SDK for VisualStudio. |
I got it fixed on Fedora 30 just by removing .net core 2.2 and only having .net core 3 installed. |
While working with Blazor, adding omnisharp.json wasn't enough, I had to install de 2019 build tools.
I'm using Chocolatey, so to do this I installed visualstudio2019buildtools and visualstudio2019-workload-netcorebuildtools. Anyone who uses it probably would just need the to install the last one, because it already has the first as a dependency. :) |
Uninstalling all but 3.x and doing the comment by @filipw worked for me on Windows. |
For anyone finding this a bit later. I was using VSCode on Mac OS.... I had mono 6.0.0 installed and had the red lines everywhere. Upgraded to 6.4.0 stable (Visual Studio Version) and it's working great. No red lines. |
Issue Description
C# Extensions complains "The type or namespace name 'System' could not be found ..." (likewise System.String, System.Object, System.Void, etc.)
This happens only when Target Framework = netcoreapp3.0.
No problems for netcoreapp2.0, netcoreapp2.1, nor netcoreapp2.2.
Code builds and runs fine at command prompt.
Steps to Reproduce
dotnet new console
dotnet build
=> builds successfullydotnet run
=> runs successfullyExpected Behavior
C# Extensions displays c# code without any errors independent of whether TargetFramework = netcoreapp3.0, 2.2, 2.1, or 2.0.
Actual Behavior
C# Extensions accepts code for 2.0, 2.1, and 2.2.
For netcoreapp3.0 completely different behavior => C# Extensions complains of syntax errors (no type or namespace name) for System, System.String, System.Object, System.Void, etc.
Logs
OmniSharp log
Starting OmniSharp server at 9/23/2019, 11:34:25 PM
Target: c:\DEV\OmniDemo
OmniSharp server started.
Path: C:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3\OmniSharp.exe
PID: 13104
Starting OmniSharp on Windows 6.2.9200.0 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2017 15.9.28307.770 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
2: StandAlone 16.0 - "c:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'c:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3.msbuild\Current\Bin\MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.0 - "c:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3.msbuild\Current\Bin"
CscToolExe = csc.exe
CscToolPath = c:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3.msbuild\Current\Bin\Roslyn
MSBuildExtensionsPath = c:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3.msbuild
MSBuildToolsPath = c:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3.msbuild\Current\Bin
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\DEV\OmniDemo'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\DEV\OmniDemo'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\DEV\OmniDemo\OmniDemo.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\DEV\OmniDemo'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\DEV\OmniDemo\OmniDemo.csproj
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\DEV\OmniDemo' on host 3140.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\DEV\OmniDemo\OmniDemo.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\DEV\OmniDemo\OmniDemo.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: OmniDemo
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
OmniDemo: Did not find 'Microsoft.NETCore.App' in lock file.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\DEV\OmniDemo\OmniDemo.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\DEV\OmniDemo\OmniDemo.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\DEV\OmniDemo\OmniDemo.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Update project: OmniDemo
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
OmniDemo: Did not find 'Microsoft.NETCore.App' in lock file.
C# log
C# log is EMPTY
Environment information
VSCode version: 1.38.1
C# Extension: 1.21.3
Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: