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

dotnet package search crashes on .NET 9 preview 2 nightly #13286

Closed
baronfel opened this issue Mar 1, 2024 · 5 comments · Fixed by NuGet/NuGet.Client#5668
Closed

dotnet package search crashes on .NET 9 preview 2 nightly #13286

baronfel opened this issue Mar 1, 2024 · 5 comments · Fixed by NuGet/NuGet.Client#5668
Assignees
Labels
Area:Versioning Partner:DotNet Platform:Xplat Priority:1 High priority issues that must be resolved in the current sprint. Type:Bug
Milestone

Comments

@baronfel
Copy link

baronfel commented Mar 1, 2024

NuGet Product Used

dotnet.exe

Product Version

9.0.100-preview.2.24129.7

Worked before?

unknown

Impact

I'm unable to use this version

Repro Steps & Context

Using the .NET 9 preview 2 release candidate build, dotnet package search crashes on activation:

> dotnet package search
Unhandled exception. System.MissingMethodException: Method not found: 'Void System.CommandLine.CliCommand.Add(System.CommandLine.CliSymbol)'.
   at NuGet.CommandLine.XPlat.ConfigCommand.RegisterOptionsForCommandConfigPaths(CliCommand cmd, Func`1 getLogger)
   at NuGet.CommandLine.XPlat.ConfigCommand.Register(CliCommand app, Func`1 getLogger)
   at NuGet.CommandLine.XPlat.Program.MainInternal(String[] args, CommandOutputLogger log)
   at NuGet.CommandLine.XPlat.Program.Main(String[] args)

My best guess is a System.CommandLine version mismatch, but it would need some investigation to verify.

Verbose Logs

No response

@Nigusu-Allehu
Copy link
Contributor

Nigusu-Allehu commented Mar 1, 2024

It looks like the ConfigCommand which is not dotnet package search is trying to use the CliCommand.Add() method which has two different contracts in different versions of System.CommandLine
In versions that are built after this PR dotnet/command-line-api#2205, the contract is Void System.CommandLine.CliCommand.Add(System.CommandLine.CliOption) || Void System.CommandLine.CliCommand.Add(System.CommandLine.CliArgument).
However, in versions that are built before the PR, the contract is Void System.CommandLine.CliCommand.Add(System.CommandLine.CliSymbol).
Dotnet SDK uses the version 2.0.0-beta4.24126.1 which is the latest according to https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-libraries/NuGet/System.CommandLine/versions/2.0.0-beta4.23307.1
However according to the error it looks like the NuGet build was compiled with the old contract which does not exist anymore.

@martinrrm
Copy link
Contributor

Something must have changed recently, we have two packages that use System.CommandLine package, and we are not consistent on how we add an Option and Arguments to a CliCommand in package search we do CliCommand.Options.Add(CliOption) and in config we do CliCommand.Add(CliOption).

I believe that we are using the same source of System.CommandLine in SDK and NuGet but that could have changed, we need to verify that. Also, if this is happening just in Preview 2, it could also mean that the package changed it's API's but I don't see it in their commits.

SDK also has a source that contains System.CommandLine package https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-public/NuGet/System.CommandLine/versions/2.0.0-beta4.22272.1, not sure if it's taking this source instead

@Nigusu-Allehu Nigusu-Allehu added the Priority:1 High priority issues that must be resolved in the current sprint. label Mar 4, 2024
@nkolev92
Copy link
Member

nkolev92 commented Mar 4, 2024

@Nigusu-Allehu can you please add the behavior for each version of the interest.
8.0.2xx?
8.0.3xx
.NET 9, P1
.NET 9, P2

@martinrrm
Copy link
Contributor

@Nigusu-Allehu @nkolev92 8.0.2xx and 8.0.3xx is working, .NET 9 is not working at all. I just created a PR NuGet/NuGet.Client#5668

@martinrrm
Copy link
Contributor

8.0.2xx doesn't contain the dotnet nuget config command, 8.0.3xx does, I'm still not sure why is failing just for .NET 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Versioning Partner:DotNet Platform:Xplat Priority:1 High priority issues that must be resolved in the current sprint. Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants