Skip to content

.Net 5.0 Int.Parse fails parsing with negative values. #40258

@eriksimonic

Description

@eriksimonic

.Net 5.0 Preview 7, fails on Int.Parse("-1") with
Message:
System.FormatException : Input string was not in a correct format.
Stack Trace:
Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)
Int32.Parse(String s)
NetCore50prev7_Tests.NegativeIntegerFailsParse() line 15

public class NetCore50prev7_Tests
{
[Fact]
public void NegativeIntegerFailsParse()
{
int.Parse("-1");
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.GlobalizationquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions