Skip to content

Underscore in numbers are not handled correctly #83

@fh-yuxiao-zeng

Description

@fh-yuxiao-zeng

YAML allows underscores in numbers to increase readability (see https://yaml.org/type/int.html. "Any “_” characters in the number are ignored, allowing a readable representation of large values.")

However, it seems that this library can't handle it properly. Given a standard ASP.NET Core application and a config like this:

Kestrel:
  Limits:
    MaxRequestLineSize: 16_384
    MaxRequestBodySize: 104_857_600

I see an exception like this:

Unhandled exception. System.InvalidOperationException: Failed to convert configuration value at 'Kestrel:Limits:MaxRequestLineSize' to type 'System.Int32'.
 ---> System.ArgumentException: 16_384 is not a valid value for Int32. (Parameter 'value')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions