-
Notifications
You must be signed in to change notification settings - Fork 686
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
The type or namespace name 'System' could not be found #2147
Comments
@dmumladze Thanks for including your omnisharp log. Can you try deleting the |
To reinstall omnisharp, you also need to delete the |
If I delete .omnisharp folder, I cannot install as I'm behind a corp. proxy, so I had to do it manually. I've done the same manual installation before many times and also tried to reinstall manually few times now. I've also cleaned up .nuget and .dotnet cached folders. And yes, before the CLI upgrade it worked. So far nothing worked. Can one of you install the latest CLI along with latest VSCode/Omnisharp and see if it works? |
Still monitoring this issue? |
@dmumladze I can confirm that CLI version 2.1.300-preview3-008443 seems to work for me, at least when creating a simple class library. |
@dmumladze Have you tried deleteing build/restore artifacts (whatever the moral equivalent of |
@rchande I deleted the entire source branch and did rebuild/restore from scratch..still the same. |
@dmumladze Is there a way I could get access to this project in order to debug further? Also, I noticed one interesting discrepancy, but I'm not sure if it means anything: In your O# log, the project directory contains an obj directory (as you would expect after restore). However, in your screenshot, there's no obj directory visible. Any idea why that might be? |
Also, @dmumladze if it's not possible for you to share all the source (.cs) files, would it be possible for you to share a version of the .csproj file with anything private removed? I suspect that that's where the problem lies... |
@dmumladze One more question for you: I noticed that the output |
@obj directory missing: It's hidden from .settings file Unfortunately I cannot share. |
This should help diagnose missing references in dotnet/vscode-csharp#2147
@dmumladze My current hypothesis is that something is going wrong when OmniSharp uses MSBuild to build your project that results in us not finding the right reference paths. I added some diagnostics to OmniSharp to collect more info. Please give this a try: Then, do whatever you did to load your project and share your OmniSharp log again. Note that it will print lots of file paths. If you want to elide your username, go ahead, but try to leave paths as intact as possible. Hopefully this will help us diagnose what's happening on your machine. |
@rchande thanks for the build. I'm behind the proxy, and even though I set correct settings, I'm still not able to download neither extension nor "latest" per configuration you've provided ( The proxy issue is something that's been there in VS Code for a long time. Note that I'm using proxy settings as below, but it never works (let's leave this as is for now).
OR
So, back to the extension issue... I was only able to install C# Extension
I removed And lastly, I've uninstalled all but latest SDK so the updated
|
@dmumladze Try downloading this https://roslynomnisharp.blob.core.windows.net/releases/1.29.2-beta.139/omnisharp-win-x86.zip . Unzip it wherever you like and use the omnisharp.path setting to point at the omnisharp.exe within it. |
@rchande All my projects are multi-targeting, could that be an issue? It was certainly not an issue with .NET Core 2.0.3 and VS Code 1.20.
|
OmniSharp will only process the first TFM in your project. Maybe try switching them? |
@DustinCampbell I think switching isn't needed, since projects I'm opening in VS Code are the ones needed to be built for .NET Core. |
Did you try and find that it didn't make a difference? |
I suspect that this might be the same issue as #2295 |
We've merged a fix to #2295 to OmniSharp. Try setting |
@DustinCampbell We have stopped using VSCode for now... It is unfortunate, but it's the decision we made due to this and other issue. For the other issue, there seems to be solution in using a different NTLM lib. |
@dmumladze Sorry to hear that. If you have time, it would be helpful to us (and other users) if you could confirm whether the fix for #2295 works for you. |
not sure if this is related/helpful. I had two visual studio code instances open, one was my angular CLI project (which was open first) then I launched a new visual studio code instance and opened my C# project folder and received this error/issue. after closing both and only opening my C# project the issue went away. |
Getting this with latest stuff. CoreFx 3.0.0 preview 2 My personal home workstation, Nothing special about the network here. Edit: I investigated a little more and saw that I'm experiencing OmniSharp/omnisharp-roslyn#1094. |
I had those installed. |
Experiencing the same issue on macOS. Attempted resolution:
Attempted with .NET Core 3.0 Preview 1:
Attempted again with .NET Core 3.0 Preview 3:
C# extension constantly tells me I need to restore packages. Upon restoring, it immediately prompts again. However, my project doesn't rely on any NuGet packages: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>8.0</LangVersion>
<NullableReferenceTypes>true</NullableReferenceTypes>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
</PropertyGroup>
</Project> Here's what shows up when I click the
There are two warnings in the OmniSharp log:
Presumably 3.0.0-preview-27324-5 < 3.0.0. Since I'm not explicitly specifying a version anywhere besides TargetFramework, and that TargetFramework works fine in VS 2019 Preview, I'm unsure how to proceed.
Issue vanishes if I target netcoreapp2.2. |
Confirmed that this remains an issue even with a fresh project created with <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project> |
I ran into this when installing 3.0.0-preview3 (was on 3.0.0-preview before). Some logs in case it helps (project path/name are anonymized):
dotnet --info:
After restarting VS Code:
|
Similar issue on mac too. C# Extension version: 1.18.0 Issue: Every time I start my Unity project(C# project), I got a message.
It is really weird cause my machine is mac, not window. (try to find .exe file on mac?) My Solution: Comment out following line.
Result:
I got these messages on Output window, and Everything goes fine. |
I am also having issues with Omnisharp, I've tried deleting everything, reinstalling on mac. I am getting a whole bunch of type or namespace errors, but when I use VS2019 it works just fine.
|
Disable the C# plugin and the error messages will go away (KISS). |
I had been dealing with the same issue for an hour. I have tried everything here and none of them worked but as a final try, I uninstall C# extension once more, then reload, then install it again. Now it is working! It must be a really weird bug. |
Same issue. Only context I can provide other than the above is that this started occurring after updating the project to use .NET Core SDK 3.0.
At this point the errors started being reported in the Problems panel. |
please provide OmiSharp log when reporting any issues, otherwise there is no way to diagnose any problem, thanks |
For some reason, updating Visual Studio 2019 to v16.3.3 (from v16.2.4). No clue why that would effect anything, but the errors suddenly went away part-way through that install. Unfortunately, this means I don't have any errors to log for your investigation now. Hopefully someone else can provide. |
OmniSharp uses msbuild from Visual Studio 2019 if it's installed on your machine. So if you had VS 2019 16.2, then OmniSharp used that msbuild and it was too old to support .NET Core 3.0 RTM which caused your errors. |
If it's not installed, OmniSharp will use the msbuild version from the SDK? Or is the decision tree more complex than that? Just getting a full understanding so I can communicate out to my organization. |
if it's not installed, then it uses it's own bundled msbuild which is now version 16.3 (but a simpler version that cannot handle i.e some Unity projects or complex legacy frameworks, that's why VS is always preferred). .NET Core 3.0 has raised the minimum msbuild level required from 16.0 to 16.3 between the final previews and RTM version, which caught us a bit off guard, that's why OmniSharp worked fine with previews but not RTM of .NET Core 3.0, as we used to ship with 16.0 - which is really what this entire issue has been about. hope this explains |
Installing VS 2019 16.3.x worked for me 👍 |
Explains perfectly. Thanks! |
I was having the same issue. Agree with the last explanation, upgraded my msbuild to 16.6 and works fine now! |
I am having the same issue with latest everything at this moment (Windows 10, vs & msbuild 16.7, vscode 1.47.3, omnisharp is 'latest'). My debug log of omnisharp is here Can anybody help ? I hate to open VS just because of this. I wasn't sure which msbuild it uses so I deleted folder containing internal one at |
does it work in VS? your omnisharp log has no errors so it's difficult to say |
Yes, it works. It works with dotnet CLI too. My omnisharp log shows missing namespaces
|
yes, but those are compiler diagnostics, not OmniSharp errors. I was referring to the fact that there is nothing suspicious in OmniSharp loading process. You can try the latest prerelease https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.23.0-beta2 (make sure to remove "omnisharp.path":"latest" setting before). Also, can you provide a repro project? btw. your problem is different from the one tracked in this thread which was related to discovery of system ref assemblies. |
I will close this issue to avoid any further confusion. The original issue tracked here was caused by old MSBuild (later MSBuild < 16.3 for .NET Core 3.x apps) being discovered. We have raised the minimum discovered version of MSBuild in the meantime. |
OK @filipw , I reported new problem at #3962. |
Environment data
dotnet --info
output:VS Code version:
1.21.1
C# Extension version:
1.14.0
Issue:
I upgraded from VS Code 1.19 and C# Extension 1.13 to the latest VS Code and # Extension and all of sudden every reference is all messed up, but I'm able to do
dotnet build
without issues. Attached screenshot and trace logs from OmniSharp.OmniSharp.log
The text was updated successfully, but these errors were encountered: