Closed Aenge closed 3 years ago
Do you have a repro project?
Do you have a repro project?
I just threw this together: https://github.com/Aenge/ReadAsyncRepro
Note the exception shown out of the box will be different than the one in the OP; there is a note regarding that in CustomProtocol.cs
This call is illegal https://github.com/Aenge/ReadAsyncRepro/blob/0800d1484d42b83e391c6ff4fedeb115a6126034/ReadAsyncRepro/CustomProtocol.cs#L26
You can't use this unless you were the one that created the ReadOnlySequence and you know what the underlying representation is.
This call is illegal https://github.com/Aenge/ReadAsyncRepro/blob/0800d1484d42b83e391c6ff4fedeb115a6126034/ReadAsyncRepro/CustomProtocol.cs#L26
You can't use this unless you were the one that created the ReadOnlySequence and you know what the underlying representation is.
I've tried without that call as well and it still throws. I've updated the repro project. https://github.com/Aenge/ReadAsyncRepro/commit/f904d6e88d90798fdf3295f728adc6f9ed5e77ad
I can reproduce the issue! Thanks
I'll take a deeper look at this today.
Thanks for the fast response. Our cancellations are working as expected now. 👍
Thanks for using the library!
I'm writing a server that uses a heartbeat packet. After 10s of inactivity on the socket, the server sends a PING to the client. If using a ProtocolReader, when the PONG comes in, an exception is thrown.
Line 44 is the protocolReader.ReadAsync instruction exactly as shown above. For testing, I tried sending the PING outside of the exception handler, and was able to receive the PONG with no issues. It seems to be related to the operation cancellation. Also, if I replace the protocol reader with a standard pipe reader, this issue does not occur.