-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ForEachAsync continues after cancellation token is cancelled #1940
Comments
Having reproduced this and traced through the behaviour, I think we've found the problem. It's here: reactive/AsyncRx.NET/System.Reactive.Async/Linq/Operators/ForEachAsync.cs Lines 127 to 129 in 95d9ea9
The call to
Once we reach that closing But that's too early. We should do this only after the |
So, although this isn't going to be terribly complex to fix, the larger problem here is that because Async.Rx was always an experimental feature, it doesn't have any tests. Normally when fixing a bug I like to ensure that tests exist that would detect the problem so we can avoid regressions, and possibly detect other problems of a similar nature. However, I'm not sure how soon we'll be able to address the lack of tests. As you can see from that other issue, we are hoping to work out some way of sharing test logic across normal and async Rx, so that we don't have to maintain two parallel, near-identical sets of tests. But that's a fairly large undertaking, and not something we expect to complete imminently. So we could just fix this without a test as a stopgap. Is this problem causing you problems right now, or was it just a curiosity that you noticed? If this is blocking you, I'll fix it without waiting until we have a proper answer for how to test AsyncRx.NET. |
It was for something experimental, so please don't feel you have to fix it for myself. Feel free to close if you'd rather track the issue in another way. |
Bug
Which library version?
System.Reactive.Async 6.0.0-alpha.3
System.Reactive.Linq 5.0.0"
What are the platform(s), environment(s) and related component version(s)?
N/A
What is the use case or problem?
Cancelling ForEachAsync should stop the enumeration.
What is the expected outcome?
Enumeration stopped after token cancelled
What is the actual outcome?
Enumeration continues forever
Do you have a code snippet or project that reproduces the problem?
I might be just completely misunderstanding but the behaviour seems odd.
The text was updated successfully, but these errors were encountered: