Skip to content

Parsing of BigInt broken in recent versions #14845

@LeeHolmes

Description

@LeeHolmes

In Windows PowerShell, this used to properly parse a string as a BigInt:

$num1 = [BigInt] "962822088399213984108510902933777372323"

Example:

PS C:\Users\lee> Trace-Command TypeConversion -PSHost { $num1 = [BigInt] "962822088399213984108510902933777372323" }
DEBUG: TypeConversion Information: 0 : Parse result: 962822088399213984108510902933777372323

In PowerShell, this now incorrectly converts first to an integer and will likely break anybody using BigInt:

[D:\Lee\Cookbook4\windows-powershell-cookbook-4e]
PS:67 > $num1 = [BigInt] "962822088399213984108510902933777372323"

[D:\Lee\Cookbook4\windows-powershell-cookbook-4e]
PS:68 > $num1
962822088399213912109618944997163270144

[D:\Lee\Cookbook4\windows-powershell-cookbook-4e]
PS:69 > Trace-Command TypeConversion -PSHost { $num1 = [BigInt] "962822088399213984108510902933777372323" }
DEBUG: 2021-02-18 10:37:04.9108 TypeConversion Information: 0 : Converting to integer.
DEBUG: 2021-02-18 10:37:04.9122 TypeConversion Information: 0 : Converting "9.628220883992139E+38" to "System.Numerics.BigInteger".
DEBUG: 2021-02-18 10:37:04.9132 TypeConversion Information: 0 :     Constructor result: "962822088399213912109618944997163270144".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions