Skip to content
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

Fix StringStreamDataWriter.toString to not consume buffer #384

Merged

Conversation

krzema12
Copy link
Owner

@krzema12 krzema12 commented Jan 25, 2025

During debugging, it was confusing to see some contents of the buffer when pausing in the debugger before an assertion, but then seeing the assertion fail. It didn't make sense why the assertion fails - the value of the buffer was as expected.

It turned out that the debugger called toString(), consuming the buffer, and leaving an empty buffer when performing the assertion. The solution here is to just peek() the buffer in toString(), not consume it.

@krzema12 krzema12 marked this pull request as ready for review January 26, 2025 09:00
@krzema12 krzema12 enabled auto-merge (squash) January 26, 2025 09:00
@krzema12 krzema12 requested a review from OptimumCode January 26, 2025 09:01
@krzema12 krzema12 merged commit beeb568 into main Jan 26, 2025
12 checks passed
@krzema12 krzema12 deleted the fix-StringStreamDataWriter.toString-to-not-consume-buffer branch January 26, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants