kellyethridge / VBCorLib

The VBCorLib framework brings many of the powerful .NET classes to VB6.
http://www.kellyethridge.com/vbcorlib/
MIT License
112 stars 28 forks source link

BigInteger.Parse when parsing negative hex string is inconsistent #83

Closed kellyethridge closed 3 years ago

kellyethridge commented 3 years ago

Parsing a hex string that represents a negative value has inconsistent results. The ToByteArray seems to return the correctly expected byte sequence, however, the ToString method returns an incorrect result.

Set Value = BigInteger.Parse("FF", NumberStyles.AllowHexSpecifier)

The ToByteArray correctly returns 0xFF. The ToString method return -65281 (0xFFFF00FF). It should return -1.

Something is getting confused in the parsing or possibly the ToString method.