-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigInteger.TryParse incorrectly parses "80000000" from hex as -4294967295 #54251
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsDescriptionFrom PowerShell/PowerShell#15587. Possibly related to #50385? However, in this case this behaviour represents a regression from .NET 6 preview 5. Repro: using System;
using System.Diagnostics;
using System.Globalization;
using System.Numerics;
using System.Runtime.InteropServices;
namespace repro
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine($".NET: '{RuntimeInformation.FrameworkDescription}'");
string numStr = args.Length > 0
? args[0]
: "80000000";
BigInteger.TryParse(numStr, NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out BigInteger bi);
Console.WriteLine($"Expected: '{numStr}'");
Console.WriteLine($"Actual: '{bi.ToString("X")}'");
Debug.Assert(bi.ToString("X") == numStr);
}
}
} Configurationx64 Windows PC:
Regression?This previously worked in .NET 6 preview 4. Other information
|
Looks like this was fixed in #54262. |
Description
From PowerShell/PowerShell#15587.
Possibly related to #50385?
However, in this case this behaviour represents a regression from .NET 6 preview 5.
Repro:
Configuration
x64 Windows PC:
Regression?
This previously worked in .NET 6 preview 4.
Other information
The text was updated successfully, but these errors were encountered: