NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 252 forks source link

ArgumentException with invalid command+arg #10905

Open mausch opened 3 years ago

mausch commented 3 years ago

Details about Problem

NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe):

dotnet.exe

Product version:

$ dotnet --version
5.0.100

$ dotnet nuget --version
NuGet Command Line
5.8.0.6930

Worked before? If so, with which NuGet version:

No idea tbh.

Repro steps and/or sample project

$ dotnet nuget kk ''
System.ArgumentException: Value cannot be null or whitespace. (Parameter 'token')
   at Microsoft.DotNet.Cli.CommandLine.OptionError..ctor(String message, String token, AppliedOption option) in /_/src/source/CommandLine/OptionError.cs:line 21
   at Microsoft.DotNet.Cli.CommandLine.Parser.UnrecognizedArg(String arg) in /_/src/source/CommandLine/Parser.cs:line 170
   at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at Microsoft.DotNet.Cli.CommandLine.Parser.Parse(IReadOnlyCollection`1 rawArgs, Boolean isProgressive) in /_/src/source/CommandLine/Parser.cs:line 107
   at Microsoft.DotNet.Cli.CommandLine.Parser.Parse(String[] args) in /_/src/source/CommandLine/Parser.cs:line 31
   at Microsoft.DotNet.Cli.ParserExtensions.ParseFrom(Parser parser, String context, String[] args)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
dominoFire commented 3 years ago

Thanks for your report, @mausch

Could you try using latest dotnet SDK (5.0.300) ? https://dotnet.microsoft.com/download/dotnet/5.0

Which OS are you using?

Are you setting SHOW_NUGET_STACK environment variable, as documented here ?

mausch commented 3 years ago

Same exception with 5.0.300 :

docker run --rm -it mcr.microsoft.com/dotnet/sdk:5.0.300-buster-slim dotnet nuget kk ''

I'm not setting SHOW_NUGET_STACK (or NUGET_SHOW_STACK according to the docs?)

dominoFire commented 3 years ago

Yes, NUGET_SHOW_STACK is the correct environment variable. Sorry for the confusion.