question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ProtocolReader.ReadAsync doesn't advance if read is successful

See original GitHub issue

The AdvanceTo is only invoked when read fails; most protocols will involve multiple messages, but the second call to ReadAsync reliably fails with:

Unhandled exception. System.InvalidOperationException: Advance must be called before calling ReadAsync

Repro is here

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mgravellcommented, Jan 29, 2020

On the API design: I think I’m in favor of the explicit Advance. This ties in well with allowing me to do a zero-copy parse that just deframes segments of the original buffer. Then we can call Advance once the deframed data has been processed. So: nothing to see here!

0reactions
mgravellcommented, Feb 6, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading binary data in c# / ReadAsync not ...
1 Answer 1 · what I was wondering is if the program could hit this condition if it is reading a file locally,...
Read more >
CCS/RM48L952: TI Fee Read Async Operation Question
When I perform a readback via TI_Fee_Read on the newly written block, the reading doesn't contain valid data samples although taking a look ......
Read more >
Stream.ReadAsync Method (System.IO)
Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read....
Read more >
Pipe Dreams, part 2 - Marc Gravell
When the read is complete, it commits that-many bytes to the pipe using Advance , then it invokes FlushAsync() on the pipe to...
Read more >
BufferedStream.ReadAsync Method (System.IO)
Asynchronously reads a sequence of bytes from the current buffered stream and advances the position within the buffered stream by the number of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found