dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

Failure with .NET Core 2.0.0-preview2 SDK #1495

Closed nguerrera closed 7 years ago

nguerrera commented 7 years ago

From @cesarbs on May 18, 2017 17:18

Got this in VS Code with the latest pre-release version of the C# extension (1.10.0-beta3):

[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The "ResolvePackageDependencies" task failed unexpectedly.
This is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.
System.TypeLoadException: Could not resolve type with token 01000040
  at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.GetPackageAndFileDependencies (NuGet.ProjectModel.LockFileTarget target) [0x0011f] in <9445a2665fcc4f009bbfa9fcd34c78f9>:0 
  at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.RaiseLockFileTargets () [0x000a6] in <9445a2665fcc4f009bbfa9fcd34c78f9>:0 
  at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.ExecuteCore () [0x00006] in <9445a2665fcc4f009bbfa9fcd34c78f9>:0 
  at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <9445a2665fcc4f009bbfa9fcd34c78f9>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x0002a] in <6a1392588f4a45bdbe07807130f9b3d0>:0 
  at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x002bf] in <6a1392588f4a45bdbe07807130f9b3d0>:0 
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/Cesar/src/aspnet/KestrelHttpServer/src/Microsoft.AspNetCore.Server.Kestrel.Core/Microsoft.AspNetCore.Server.Kestrel.Core.csproj'.
/Users/Cesar/src/aspnet/KestrelHttpServer/src/Microsoft.AspNetCore.Server.Kestrel.Core/Microsoft.AspNetCore.Server.Kestrel.Core.csproj

Happens on every project in Kestrel.

dotnet info:

$ dotnet --info
.NET Command Line Tools (2.0.0-preview2-006082)

Product Information:
 Version:            2.0.0-preview2-006082
 Commit SHA-1 hash:  6453cb4e15

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /Users/Cesar/.dotnet/sdk/2.0.0-preview2-006082/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview2-25309-07
  Build    : 41f5fc94eedc889f086800c23f35bf14a8c75a9f

Copied from original issue: dotnet/sdk#1229

DustinCampbell commented 7 years ago

Lets hope next build of CLR don't break it again, ehhehehe :P

I'm not sure what you mean. The CLR hasn't been an issue in this thread.

galvesribeiro commented 7 years ago

@DustinCampbell It happened with very last netcore 2.0 bits and that include the SDK, CLR, right? I meant that we are not sure if a new build of netcore would not break again, just like in this issue. But in all cases, good work :) thanks for get it back working for us :)

julielerman commented 7 years ago

thanks. The simple things I was missing like formatting an intellisense an help to do things like "hey you need a ref to this assembly" are all working again as expected! :)

DustinCampbell commented 7 years ago

@galvesribeiro: C# for VS Code doesn't run OmniSharp on .NET Core. On Windows, it runs on the desktop CLR that's already installed. On OSX/Linux, it runs on a local Mono that C# for VS Code installs.

There were three problems that sort of cascaded into a perfect storm of fail. :smile:

  1. NuGet made API breaking changes without updating their assembly version numbers. When those changes were deployed with the .NET Core SDK, many things broke, such as C# for VS Code and Live Unit Testing in Visual Studio 2017. This has been fixed and included in newer .NET Core SDK builds.
  2. On OSX/Linux, we needed to deploy a new Mono runtime with a new "strict assembly loader" feature to ensure that assemblies with different versions can be loaded side-by-side (just like they are on the CLR on Windows). This was necessary because of the NuGet changes above. OmniSharp itself deploys 4.0.0.0 versions of some NuGet assemblies and the latest .NET Core SDK deploys newer versions. Since these two versions have different API surface area, they collided badly.
  3. There was a bug in the "strict assembly loader" feature on Mono that I discovered yesterday. There are more details on that issue in https://github.com/OmniSharp/omnisharp-vscode/issues/1566.

Now, we're in a much better place for not getting broken in the future.

DustinCampbell commented 7 years ago

thanks. The simple things I was missing like formatting an intellisense an help to do things like "hey you need a ref to this assembly" are all working again as expected! :)

Excellent! I'll expect a hug and a beer when I see you next. :grin:

galvesribeiro commented 7 years ago

Yay! Good news @DustinCampbell! Thanks for the clarification.