Skip to content
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

OmniSharp does not support .NET Core SDK 2.0-preview2 builds #865

Closed
wjk opened this issue May 18, 2017 · 16 comments
Closed

OmniSharp does not support .NET Core SDK 2.0-preview2 builds #865

wjk opened this issue May 18, 2017 · 16 comments
Assignees

Comments

@wjk
Copy link

wjk commented May 18, 2017

When using the version of OmniSharp included with omnisharp-vscode version 1.10.0-beta3 with Visual Studio Code on my (proprietary) .NET Core project, I get a very strange error on each csproj in my solution. The full OmniSharp log is included:

Starting OmniSharp server at 5/18/2017, 10:00:25 AM
    Target: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln

OmniSharp server started wth Mono
    Path: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta2/bin/run
    PID: 1051

OmniSharp: -s /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln --hostPID 1018 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/Volumes/Sources/GrouperTools/System.DirectoryServices' on host 1018."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Volumes/Sources/GrouperTools/System.DirectoryServices
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBUILD_EXE_PATH environment variable set to /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta2/bin/omnisharp/msbuild/MSBuild.dll
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuildExtensionsPath environment variable set to /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta2/bin/omnisharp/msbuild
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuild will use local OmniSharp installation.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.Security.Permissions/System.Security.Permissions.csproj
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.Security.Permissions/System.Security.Permissions.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.Security.Permissions/System.Security.Permissions.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/dotnet-resgen.csproj
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/dotnet-resgen.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/dotnet-resgen.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices/System.DirectoryServices.csproj
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices/System.DirectoryServices.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices/System.DirectoryServices.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.AccountManagement/System.DirectoryServices.AccountManagement.csproj
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.AccountManagement/System.DirectoryServices.AccountManagement.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.AccountManagement/System.DirectoryServices.AccountManagement.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols.csproj
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Volumes/Sources/GrouperTools/System.DirectoryServices'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Startup
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.

What makes this so hard to diagnose, is that it doesn’t tell me which type it is failing to load! It simply says token 01000040, which could mean anything. My best guess is that it can’t find or can’t load the NuGet build-time assembly, because the stack frame just before the error includes a type from that assembly in the signature.

The version of OmniSharp included in omnisharp-vscode 1.9.0 parses this solution without complaint. Any pointers? Thanks!

@DustinCampbell
Copy link
Contributor

The log above appears to be running OmniSharp from 1.10-beta2, not 1.10-beta3, is that correct? Also, could you set omnisharp.loggingLevel to debug in VS Code and provide the OmniSharp log again?

@wjk
Copy link
Author

wjk commented May 18, 2017

@DustinCampbell Yeah, I forgot to re-capture the log after testing on beta3. Sorry about that! I can say that beta3 breaks exactly the same as beta2 does, however. I will get you a more detailed log later today. Thanks!

@DustinCampbell
Copy link
Contributor

Note that the biggest difference is that OmniSharp no longer includes the various .NET SDKs. Instead, it tries to locate the .NET CLI relevant for a project and use the SDKs from there. I suspect the issue is going to be something around that.

@wjk
Copy link
Author

wjk commented May 18, 2017

Here is the debug log for OmniSharp. Note that this problem only occurs on my Mac workstation; my Windows 10 workstation loads the solution just fine.

Starting OmniSharp server at 5/18/2017, 1:10:05 PM
    Target: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln

OmniSharp server started wth Mono
    Path: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/run
    PID: 699

OmniSharp: -s /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln --hostPID 607 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel debug formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.Startup","Message":"Loaded OmniSharp.DotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},"Seq":1,"Type":"event"}
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.DotNetTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.MSBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.Roslyn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.Roslyn.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.Script, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[dbug]: OmniSharp.Startup
        Loaded OmniSharp.Stdio, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[info]: OmniSharp.Startup
        Omnisharp server running using Stdio at location '/Volumes/Sources/GrouperTools/System.DirectoryServices' on host 607.
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Volumes/Sources/GrouperTools/System.DirectoryServices
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBUILD_EXE_PATH environment variable set to /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild/MSBuild.dll
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuildExtensionsPath environment variable set to /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuild will use local OmniSharp installation.
[dbug]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuild environment: 
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
MSBuildToolsDirectory64: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
MSBuildSDKsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild/Sdks
CurrentMSBuildConfigurationFile: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild/MSBuild.dll.config
CurrentMSBuildExePath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild/MSBuild.dll
CurrentMSBuildToolsDirectory: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
VisualStudioInstallRootDirectory: 
MSBuildExtensionsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.Security.Permissions/System.Security.Permissions.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildExtensionsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildSDKsPath: /usr/local/share/dotnet/sdk/2.0.0-preview2-006082/Sdks
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.Security.Permissions/System.Security.Permissions.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.Security.Permissions/System.Security.Permissions.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/dotnet-resgen.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildExtensionsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildSDKsPath: /usr/local/share/dotnet/sdk/2.0.0-preview2-006082/Sdks
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/dotnet-resgen.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/dotnet-resgen.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices/System.DirectoryServices.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildExtensionsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildSDKsPath: /usr/local/share/dotnet/sdk/2.0.0-preview2-006082/Sdks
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices/System.DirectoryServices.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices/System.DirectoryServices.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.AccountManagement/System.DirectoryServices.AccountManagement.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildExtensionsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildSDKsPath: /usr/local/share/dotnet/sdk/2.0.0-preview2-006082/Sdks
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.AccountManagement/System.DirectoryServices.AccountManagement.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.AccountManagement/System.DirectoryServices.AccountManagement.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildExtensionsPath: /Users/wjk/.vscode/extensions/ms-vscode.csharp-1.10.0-beta3/bin/omnisharp/msbuild
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Using MSBuildSDKsPath: /usr/local/share/dotnet/sdk/2.0.0-preview2-006082/Sdks
[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 '/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols.csproj'.
/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.Protocols/System.DirectoryServices.Protocols.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Volumes/Sources/GrouperTools/System.DirectoryServices'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Startup
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************ Request ************
POST - /v2/getcodeactions
************ Headers ************
Content-Type - application/json
************  Body ************
{
  "FileName": "/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/Program.cs",
  "Selection": {
    "Start": {
      "Line": 1,
      "Column": 1
    },
    "End": {
      "Line": 1,
      "Column": 6
    }
  }
}
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************ Request ************
POST - /projects
************ Headers ************
Content-Type - application/json
************  Body ************

[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************  Response ************ 
{"DotNet":{"Projects":[],"RuntimePath":null},"MsBuild":{"SolutionPath":"/Volumes/Sources/GrouperTools/System.DirectoryServices/System.DirectoryServices.sln","Projects":[]},"Script":{"Projects":[]}}
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************ Request ************
POST - /currentfilemembersastree
************ Headers ************
Content-Type - application/json
************  Body ************
{
  "FileName": "/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/Program.cs"
}
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************  Response ************ 
{"TopLevelTypeDefinitions":[]}
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************ Request ************
POST - /codecheck
************ Headers ************
Content-Type - application/json
************  Body ************
{
  "FileName": "/Volumes/Sources/GrouperTools/System.DirectoryServices/dotnet-resgen/Program.cs"
}
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************  Response ************ 
{"QuickFixes":[]}
[dbug]: OmniSharp.Middleware.LoggingMiddleware
        ************  Response ************ 
{"CodeActions":[]}

@DustinCampbell
Copy link
Contributor

OK. I see that you are using bleeding edge .NET Core SDK bits. Let me try that and see if something's been broken.

@DustinCampbell
Copy link
Contributor

OK. I can repro this with the latest .NET CLI. It looks like the most recent nightlies are busted. There are working for me if I use the latest 2.0.0-preview1 build from https://github.com/dotnet/cli/tree/release/2.0.0.

cc @livarcocc

@DustinCampbell
Copy link
Contributor

Reopening I can verify that this is really fixed.

@wjk
Copy link
Author

wjk commented May 19, 2017

@DustinCampbell Unfortunately, at least for me, it still doesn’t work. Having built omnisharp-roslyn from source, I instructed VSCode to use the net46 version. When I attempt to load the solution, it still gives me the same TypeLoadException. However, now it tells me which type it cannot load: NuGet.Packaging.Core.PackageDependency from the assembly NuGet.Packaging.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. (If I use the netcoreapp1.1 version I don’t even get that far: it simply prints “Starting OmniSharp server” and then hangs.)

@DustinCampbell
Copy link
Contributor

Yup, I'm actively looking at this. I'm rebuilding OmniSharp locally right now using the same NuGet package version that the SDK does: https://github.com/dotnet/sdk/blob/master/build/DependencyVersions.props#L13

Note: I'm also tracking this on the C# for VS Code repo here: dotnet/vscode-csharp#1495

@DustinCampbell
Copy link
Contributor

@wjk: It looks like there's a significant break in the NuGet API between 4.0.0 and 4.3.0 Apparently, NuGet.Packaging.Core.Types is being removed and its types are inlined into NuGet.Packaging.Core. This is causing some headaches.

@natemcmaster
Copy link
Contributor

@DustinCampbell so am I seeing the same issue you've just described? I'm using 1.10.0-beta5 and my .NET Core 2.0.0 projects fail to load with:

[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The "ResolvePackageDependencies" task failed unexpectedly.
System.TypeLoadException: Could not load type 'NuGet.Packaging.Core.PackagingCoreConstants' from assembly 'NuGet.Packaging.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at Microsoft.NET.Build.Tasks.NuGetUtils.IsPlaceholderFile(String path)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.IsTransitiveProjectReference(LockFileTargetLibrary package)

@DustinCampbell
Copy link
Contributor

Yup. This is a problem if you use .NET Core SDK 2.0-preview2 builds. The issue stems from the fact that several types were moved around in NuGet binaries within their 4.3.0 preview builds without updating the assembly version numbers. This also breaks the Live Unit Testing for .NET Core feature in Visual Studio 2017 15.3 preview 1 for the same reason.

The problem is compounded in OmniSharp because the Mono 4.8 runtime doesn't support SxS loading of assemblies that differ by version number. I'll be taking a newer Mono runtime build that fixes this issue.

@DustinCampbell DustinCampbell changed the title Strange TypeLoadException with .NET Core project OmniSharp does not support .NET Core SDK 2.0-preview2 builds May 25, 2017
@DustinCampbell
Copy link
Contributor

I've pushed a new release that should fix the issue on Windows and netcoreapp builds of OmniSharp. Mono builds are still busted because they require a new version of Mono that is not yet (5.2) which includes a brand new --assembly-loader=strict flag that replicates the SxS assembly loading behavior of the Windows desktop CLR.

@wjk
Copy link
Author

wjk commented Jun 7, 2017

@DustinCampbell It works, all right! My .NET Core 2.0 project now loads successfully with full IntelliSense. I would appreciate knowing when the Mac version is fixed as well, though. I'll let you decide when it would be appropriate to close this issue. Thank you very much!

@DustinCampbell
Copy link
Contributor

DustinCampbell commented Jun 7, 2017

Glad to hear it! I'll close this once the new 5.2 Mono bits show up in the channel and I can update omnisharp-vscode with them. I'm told that will likely happen this week.

@DustinCampbell
Copy link
Contributor

OK. I've gotten newer 5.2 Mono bits and updated omnisharp-vscode. There is a new beta available there that should fix this on OSX and Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants