Skip to content

dotnet completions script produces confusing error when no shell supplied #48420

Open
@slang25

Description

@slang25

Describe the bug

When running dotnet completions script in the fish shell, presumably there is some default argument handling that infers that the shell is "fish", however the CLI outputs the following error:

Image

To Reproduce

In fish shell, run just dotnet completions script, omitting the shell argument.

Exceptions (if any)

System.InvalidOperationException: The shell application 'fish' is not supported. The following shells are supported by this application: bash, pwsh, fish, zsh, nushell
   at System.CommandLine.StaticCompletions.CompletionsCommand.<.ctor>g__LookupShellFromEnvironment|2_0(Dictionary`2 shellMap)
   at System.CommandLine.StaticCompletions.CompletionsCommand.<>c__DisplayClass2_0.<.ctor>b__3(ArgumentResult argResult)
   at System.CommandLine.CliArgument`1.GetDefaultValue(ArgumentResult argumentResult)
   at System.CommandLine.Parsing.ArgumentResult.ValidateAndConvert(Boolean useValidators)
   at System.CommandLine.Parsing.ArgumentResult.GetArgumentConversionResult()
   at System.CommandLine.Parsing.CommandResult.ValidateArguments(Boolean completeValidation)
   at System.CommandLine.Parsing.CommandResult.Validate(Boolean completeValidation)
   at System.CommandLine.Parsing.ParseOperation.Validate()
   at System.CommandLine.Parsing.ParseOperation.Parse()
   at System.CommandLine.Parsing.CliParser.Parse(CliCommand command, IReadOnlyList`1 arguments, String rawInput, CliConfiguration configuration)
   at System.CommandLine.Parsing.CliParser.Parse(CliCommand command, IReadOnlyList`1 args, CliConfiguration configuration)
   at System.CommandLine.CliConfiguration.Parse(IReadOnlyList`1 args)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

Further technical details

.NET SDK:
 Version:           10.0.100-preview.4.25177.12
 Commit:            dc1869b111
 Workload version:  10.0.100-manifests.cec059fd
 MSBuild version:   17.15.0-preview-25170-04+88496b9c8

OS: macOS

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions