Since the last alteration to my propagated-completion pipeline, one of my buffer blocks never completes. Let me summarize what was working and what isn't anymore:
Previously working:
A.LinkTo(B, PropagateCompletion);
B.LinkTo(C, PropagateCompletion);
C.LinkTo(D, PropagateCompletion);
D.Receive();
// everything completes
No longer working:
A.LinkTo(B, PropagateCompletion);
C.LinkTo(D, PropagateCompletion);
await A.Completion;
someWriteOnceBlock.Post(B.Count);
// B.Complete(); commented on purpose
B.LinkTo(C, PropagateCompletion);
D.Receive();
// Only A reaches completion
// B remains in 'waiting for activation'
// C executes but obviously never completes since B doesn't either
If I uncomment the commented line, everything works, but obviously that line should not be necessary.
Somehow my BufferBlock B never reaches completion, even though the block linked to it is completed and propagates its completion, and the block linked from it receives all the buffered items.
By awaiting the completion of A none of the remaining code is executed until A completes. That's how await works - the code after it is wrapped in a continuation ready for the completion of the awaited code. So in this scenario B is linked to A after A completes so completion is not propagated I think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With