Open flarelee opened 3 days ago
Yes. this is counterintuitive. MailboxProcessor
does not hold any internal CancellationTokenSource
that it can cancel on Dispose
.
Internally it just does a Async.Start
. I guess if there is no stopping condition in the body, it will run even after disposal, or wait forever on a disposed handle.
We could probably add cancellation on Dispose utilizing a linked token source. Would it be a breaking change?
Please provide a succinct description of the issue.
MailboxProcessor agent did not receive message and run forever!
Expected behavior
After dispose agent, agent should stop.
Actual behavior
agent run forever.
Known workarounds
add some sleep time, it may be work.
Related information
Provide any related information (optional):
log without sleep
log with sleep