You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
The following output should be printed on the console:
2 architectures: X64, Arm64
And when running with the --help option, the default values should be properly displayed:
OPTIONS:
DEFAULT
-h, --help Prints help information
--arch <ARCHITECTURE> X64, Arm64
Actual behavior
When running without any arguments an InvalidCastException exception is thrown:
Unhandled exception. System.InvalidCastException: Object cannot be stored in an array of this type.
at System.Array.InternalSetValue(Object value, IntPtr flattenedIndex)
at System.Array.SetValue(Object value, Int32 index)
at Spectre.Console.Cli.CommandValueBinder.GetArray(CommandParameter parameter, Object value) in /_/src/Spectre.Console.Cli/Internal/Binding/CommandValueBinder.cs:line 88
at Spectre.Console.Cli.CommandValueBinder.Bind(CommandParameter parameter, ITypeResolver resolver, Object value) in /_/src/Spectre.Console.Cli/Internal/Binding/CommandValueBinder.cs:line 20
at Spectre.Console.Cli.CommandValueResolver.GetParameterValues(CommandTree tree, ITypeResolver resolver) in /_/src/Spectre.Console.Cli/Internal/Binding/CommandValueResolver.cs:line 45
at Spectre.Console.Cli.CommandBinder.Bind(CommandTree tree, Type settingsType, ITypeResolver resolver) in /_/src/Spectre.Console.Cli/Internal/CommandBinder.cs:line 7
at Spectre.Console.Cli.CommandExecutor.Execute(CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration configuration) in /_/src/Spectre.Console.Cli/Internal/CommandExecutor.cs:line 105
at Spectre.Console.Cli.CommandExecutor.Execute(IConfiguration configuration, IEnumerable`1 args) in /_/src/Spectre.Console.Cli/Internal/CommandExecutor.cs:line 86
at Spectre.Console.Cli.CommandApp.RunAsync(IEnumerable`1 args) in /_/src/Spectre.Console.Cli/CommandApp.cs:line 81
at Spectre.Console.Cli.CommandApp.Run(IEnumerable`1 args) in /_/src/Spectre.Console.Cli/CommandApp.cs:line 55
at Spectre.Console.Cli.CommandApp`1.Run(IEnumerable`1 args) in /_/src/Spectre.Console.Cli/CommandAppOfT.cs:line 38
at Program.<Main>$(String[] args) in Program.cs:line 9
When running with the --help option the default value is useless:
OPTIONS:
DEFAULT
-h, --help Prints help information
--arch <ARCHITECTURE> System.Runtime.InteropServices.Architecture[]
Additional context
A pull request is coming soon to address this issue.
The text was updated successfully, but these errors were encountered:
Information
Describe the bug
The
[DefaultValue]
attribute does not support arrays.To Reproduce
Run the following program (without passing any arguments):
Expected behavior
The following output should be printed on the console:
And when running with the
--help
option, the default values should be properly displayed:Actual behavior
When running without any arguments an
InvalidCastException
exception is thrown:When running with the
--help
option the default value is useless:Additional context
A pull request is coming soon to address this issue.
The text was updated successfully, but these errors were encountered: