Closed sharwell closed 7 years ago
:memo: I found several more cases of this in my tests for JsonReader
, which you'll find in the linked pull request (I haven't pushed the change containing these, but you'll see them later tonight in a commit with the title "Add tests for JsonReader").
This issue is fixed by commit 2ec145b5a95284994dc1f5c5191f4db053b09ca4
Code:
Expected result: Error at line 0, column 2
Actual result: Error at line 0, column 3
Cause:
TextScanner.Assert
callsTextScanner.Read
before validating the character, which causes the position to move forward by one. The current position needs to be stored in a local variable before callingRead
so it can be used for positioning in the event of an error.🔗 This was originally found in DotNetAnalyzers/StyleCopAnalyzers#2406.