Skip to content

System.CommandLine.Tests converting '123.456' fails in "fi-FI" culture on Windows #1799

Open
@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

I built ec67fa2 using .NET SDK 6.0.302 on Windows x64 and ran dotnet test --no-build in the Finnish (Finland) culture. Several tests failed, presumably because NumberFormatInfo.NumberDecimalSeparator is a comma , rather than a period .:

[xUnit.net 00:00:04.61]     System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_float_without_the_parser_specifying_a_custom_converter [FAIL]
[xUnit.net 00:00:04.62]     System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_double_without_the_parser_specifying_a_custom_converter [FAIL]
  Failed System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_float_without_the_parser_specifying_a_custom_converter [5 ms]
  Error Message:
   System.InvalidOperationException : Cannot parse argument '123.456' for option '-x' as expected type 'System.Nullable`1[System.Single]'.
  Stack Trace:
     at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result) in [REDACTED]\command-line-api\src\System.CommandLine\Binding\ArgumentConverter.cs:line 211
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]() in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\OptionResult.cs:line 55
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\SymbolResult.cs:line 158
   at System.CommandLine.ParseResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\ParseResult.cs:line 168
   at System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_float_without_the_parser_specifying_a_custom_converter() in [REDACTED]\command-line-api\src\System.CommandLine.Tests\Binding\TypeConversionTests.cs:line 545
  Failed System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_double_without_the_parser_specifying_a_custom_converter [3 ms]
  Error Message:
   System.InvalidOperationException : Cannot parse argument '123.456' for option '-x' as expected type 'System.Double'.
  Stack Trace:
     at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result) in [REDACTED]\command-line-api\src\System.CommandLine\Binding\ArgumentConverter.cs:line 211
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]() in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\OptionResult.cs:line 55
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\SymbolResult.cs:line 158
   at System.CommandLine.ParseResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\ParseResult.cs:line 168
   at System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_double_without_the_parser_specifying_a_custom_converter() in [REDACTED]\command-line-api\src\System.CommandLine.Tests\Binding\TypeConversionTests.cs:line 515
[xUnit.net 00:00:04.65]     System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_double_without_the_parser_specifying_a_custom_converter [FAIL]
  Failed System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_double_without_the_parser_specifying_a_custom_converter [3 ms]
  Error Message:
   System.InvalidOperationException : Cannot parse argument '123.456' for option '-x' as expected type 'System.Nullable`1[System.Double]'.
  Stack Trace:
     at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result) in [REDACTED]\command-line-api\src\System.CommandLine\Binding\ArgumentConverter.cs:line 211
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]() in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\OptionResult.cs:line 55
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\SymbolResult.cs:line 158
   at System.CommandLine.ParseResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\ParseResult.cs:line 168
   at System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_double_without_the_parser_specifying_a_custom_converter() in [REDACTED]\command-line-api\src\System.CommandLine.Tests\Binding\TypeConversionTests.cs:line 525
[xUnit.net 00:00:04.67]     System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_float_without_the_parser_specifying_a_custom_converter [FAIL]
  Failed System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_float_without_the_parser_specifying_a_custom_converter [2 ms]
  Error Message:
   System.InvalidOperationException : Cannot parse argument '123.456' for option '-x' as expected type 'System.Single'.
  Stack Trace:
     at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result) in [REDACTED]\command-line-api\src\System.CommandLine\Binding\ArgumentConverter.cs:line 211
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]() in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\OptionResult.cs:line 55
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\SymbolResult.cs:line 158
   at System.CommandLine.ParseResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\ParseResult.cs:line 168
   at System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_float_without_the_parser_specifying_a_custom_converter() in [REDACTED]\command-line-api\src\System.CommandLine.Tests\Binding\TypeConversionTests.cs:line 535
[xUnit.net 00:00:04.71]     System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_decimal_without_the_parser_specifying_a_custom_converter [FAIL]
  Failed System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_decimal_without_the_parser_specifying_a_custom_converter [6 ms]
  Error Message:
   System.InvalidOperationException : Cannot parse argument '123.456' for option '-x' as expected type 'System.Nullable`1[System.Decimal]'.
  Stack Trace:
     at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result) in [REDACTED]\command-line-api\src\System.CommandLine\Binding\ArgumentConverter.cs:line 211
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]() in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\OptionResult.cs:line 55
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\SymbolResult.cs:line 158
   at System.CommandLine.ParseResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\ParseResult.cs:line 168
   at System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_nullable_decimal_without_the_parser_specifying_a_custom_converter() in [REDACTED]\command-line-api\src\System.CommandLine.Tests\Binding\TypeConversionTests.cs:line 505
[xUnit.net 00:00:04.72]     System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_decimal_without_the_parser_specifying_a_custom_converter [FAIL]
  Failed System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_decimal_without_the_parser_specifying_a_custom_converter [3 ms]
  Error Message:
   System.InvalidOperationException : Cannot parse argument '123.456' for option '-x' as expected type 'System.Decimal'.
  Stack Trace:
     at System.CommandLine.Binding.ArgumentConverter.GetValueOrDefault[T](ArgumentConversionResult result) in [REDACTED]\command-line-api\src\System.CommandLine\Binding\ArgumentConverter.cs:line 211
   at System.CommandLine.Parsing.OptionResult.GetValueOrDefault[T]() in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\OptionResult.cs:line 55
   at System.CommandLine.Parsing.SymbolResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\Parsing\SymbolResult.cs:line 158
   at System.CommandLine.ParseResult.GetValueForOption[T](Option`1 option) in [REDACTED]\command-line-api\src\System.CommandLine\ParseResult.cs:line 168
   at System.CommandLine.Tests.Binding.TypeConversionTests.Values_can_be_correctly_converted_to_decimal_without_the_parser_specifying_a_custom_converter() in [REDACTED]\command-line-api\src\System.CommandLine.Tests\Binding\TypeConversionTests.cs:line 495
Test run for [REDACTED]\command-line-api\artifacts\bin\System.CommandLine.Hosting.Tests\Debug\net462\System.CommandLine.Hosting.Tests.dll (.NETFramework,Version=v4.6.2)

Failed!  - Failed:     6, Passed:   836, Skipped:     7, Total:   849, Duration: 856 ms - System.CommandLine.Tests.dll (net6.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions