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

Update NuGet to version 5.10.0 #2034

Merged
merged 3 commits into from
Aug 30, 2021
Merged

Conversation

grendello
Copy link
Contributor

@grendello grendello commented Dec 7, 2020

Fixes: #2027

Fixes the following exception when using OmniSharp on Linux (with Emacs,
but possibly breaks with other LSP clients as well):

ERROR: OmniSharp.MSBuild.ProjectLoader, The "ResolvePackageAssets" task failed unexpectedly.
System.MissingMethodException: Method not found: NuGet.ProjectModel.LockFileTarget NuGet.ProjectModel.LockFile.GetTarget(string,string)
  at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader.CreateReaderFromDisk (Microsoft.NET.Build.Tasks.ResolvePackageAssets task, System.Byte[] settingsHash)
  at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader..ctor (Microsoft.NET.Build.Tasks.ResolvePackageAssets task)
  at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups ()
  at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore ()
  at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

Currently used NuGet 5.2.0 is too old, update to 5.10.0 makes the issue
disappear.

@filipw
Copy link
Member

filipw commented Dec 7, 2020

can you please provide the repro steps for how you are running into this issue? I am myself on Mono 6.13 nightly build with MSBuild 16.8 and don't see this problem.

@JoeRobich I think you once updated these Nuget dependencies but ultimately we backed off? If I recall correctly we use the older Nuget versions as those are lowest we can support. If we bump the versions we will break some of the clients.

@JoeRobich
Copy link
Member

Well this was my understanding at the time - #1746 (comment). Wonder if we should add a global.json to our NetCoreApp2.1 test so that it builds with a 2.1 SDK in the same way as the NET5 test works.

@grendello
Copy link
Contributor Author

can you please provide the repro steps for how you are running into this issue? I am myself on Mono 6.13 nightly build with MSBuild 16.8 and don't see this problem.

I'm using Mono 6.12 (the preview repo) with msbuild 16.6 from the same repo. Simply opening a project and using OmniSharp in LSP mode triggers the above shortly after the server starts (I'm using Emacs lsp-mode, didn't try eglot)

@JoeRobich I think you once updated these Nuget dependencies but ultimately we backed off? If I recall correctly we use the older Nuget versions as those are lowest we can support. If we bump the versions we will break some of the clients.

If this is indeed the case, then please close my PR and this issue, I'll simply switch to Mono/nightly

@filipw
Copy link
Member

filipw commented Dec 7, 2020

I'm using Mono 6.12 (the preview repo) with msbuild 16.6 from the same repo. Simply opening a project and using OmniSharp in LSP mode triggers the above shortly after the server starts (I'm using Emacs lsp-mode, didn't try eglot)

the reason why I asked, is because in the linked issue you wrote that this problem happens when you build Mono from source (with MSBuild 16.8). Building from source should be roughly similar to the 6.13 nightly.

So do you get this error when running on Mono 6.12 (+msbuild 16.6) or source build (~nightly) (+msbuild 16.8)? Or when you say you build from master, you are actually referring to building Mono 6.12 version, not 6.13?

@grendello
Copy link
Contributor Author

I'm using Mono 6.12 (the preview repo) with msbuild 16.6 from the same repo. Simply opening a project and using OmniSharp in LSP mode triggers the above shortly after the server starts (I'm using Emacs lsp-mode, didn't try eglot)

the reason why I asked, is because in the linked issue you wrote that this problem happens when you build Mono from source (with MSBuild 16.8). Building from source should be roughly similar to the 6.13 nightly.

So do you get this error when running on Mono 6.12 (+msbuild 16.6) or source build (~nightly) (+msbuild 16.8)? Or when you say you build from master, you are actually referring to building Mono 6.12 version, not 6.13?

The original issue is correct. In my reply to you I referred to what I'm currently using in my setup with OmniSharp patched to use NuGet 5.8.0. Yes, I build mono/master and used to use it to run OmniSharp server, however something broke a couple of weeks ago with Mono itself (I haven't had time to look into it yet), so I switched to 6.12 instead.

@JoeRobich
Copy link
Member

My earlier concern was about regressing NET Core 2.1 SDK support. Once #2040 merges and this branch updated, I see no problem merging this change if it is passing.

@JoeRobich
Copy link
Member

Noticed that the wrong MSBuildSdksPath was being used for the failing .NET Core 2.1 projects.

                Loading project: /tmp/hy317v4y.d81/NetCore21Project/NetCore21Project.csproj
        [dbug]: OmniSharp.MSBuild.SdksPathResolver
                Set MSBuildSDKsPath environment variable to: /home/vsts/work/1/s/.dotnet/sdk/5.0.100/Sdks
        [fail]: OmniSharp.MSBuild.ProjectLoader
                The "ResolvePackageAssets" task failed unexpectedly.
                System.MissingMethodException: Method not found: NuGet.ProjectModel.LockFile NuGet.ProjectModel.LockFileUtilities.GetLockFile(string,NuGet.Common.ILogger)

Tried to fix it in #2041 by having the LegacySdkResolver locate the correct SDK path.

                Loading project: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/9h7u5eac.5fx/NetCore21Project/NetCore21Project.csproj
        [dbug]: OmniSharp.MSBuild.SdksPathResolver
                Set MSBuildSDKsPath environment variable to: /Users/runner/work/1/s/.dotnet/sdk/2.1.811/Sdks
        [fail]: OmniSharp.MSBuild.ProjectLoader
                The "ResolvePackageAssets" task failed unexpectedly.
                System.MissingMethodException: Method not found: NuGet.ProjectModel.LockFile NuGet.ProjectModel.LockFileUtilities.GetLockFile(string,NuGet.Common.ILogger)

But was met with the same error. Tried a few other things but no luck.

@JordanAnthonyKing
Copy link

Is work ongoing with this?

@RealityAnomaly
Copy link

Seems like a couple tests are failing, but otherwise it looks done?

Fixes: OmniSharp#2027

Fixes the following exception when using OmniSharp on Linux (with Emacs,
but possibly breaks with other LSP clients as well):

    ERROR: OmniSharp.MSBuild.ProjectLoader, The "ResolvePackageAssets" task failed unexpectedly.
    System.MissingMethodException: Method not found: NuGet.ProjectModel.LockFileTarget NuGet.ProjectModel.LockFile.GetTarget(string,string)
      at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader.CreateReaderFromDisk (Microsoft.NET.Build.Tasks.ResolvePackageAssets task, System.Byte[] settingsHash)
      at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader..ctor (Microsoft.NET.Build.Tasks.ResolvePackageAssets task)
      at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups ()
      at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore ()
      at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
      at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
      at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

Currently used NuGet 5.2.0 is too old, update to 5.10.0 makes the issue
disappear.
@grendello grendello changed the title Update NuGet to version 5.8.0 Update NuGet to version 5.10.0 Jul 22, 2021
@JoeRobich JoeRobich mentioned this pull request Aug 30, 2021
@JoeRobich
Copy link
Member

Thanks @grendello !

@JoeRobich JoeRobich merged commit 07a72b3 into OmniSharp:master Aug 30, 2021
@grendello grendello deleted the nuget-update branch August 30, 2021 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mono] NuGet version too old on Linux
5 participants