Reset charsConsumed when BigInteger partial parsing fails - #132278
Merged
tannergooding merged 2 commits intoAug 14, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-numerics |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes BigInteger.TryParsePartial to avoid reporting a non-zero consumed count when parsing ultimately fails during NumberToBigInteger conversion, ensuring callers don’t advance their input on unsuccessful partial parses.
Changes:
- Reset
elementsConsumedto0whenNumberToBigIntegerreturns a non-OKParsingStatusinTryParseBigIntegerNumber. - Add new
TryParsePartialinvalid test cases covering fractional inputs and an overflowing exponent (including trailing invalid characters).
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Runtime.Numerics/src/System/Number.BigInteger.cs | Resets elementsConsumed on conversion failure so partial parsing reports 0 consumed when returning failure. |
| src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs | Extends TryParsePartial_Invalid_TestData with cases intended to cover “scan succeeds, conversion fails” scenarios. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MihaZupan
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BigInteger.TryParsePartialcan scan an input successfully but later reject it duringNumberToBigInteger, leavingcharsConsumednon-zero even though the parse returnedfalse. Reset the consumed count when that conversion fails so callers do not advance after an unsuccessful partial parse.Add coverage for fractional inputs and an overflowing exponent, including trailing invalid characters.
Note
This pull request description was generated with GitHub Copilot.