BedrockFramework: ProtocolReader.ReadAsync doesn't advance if read is successful

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

About this issue

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

Most upvoted comments

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!