-
Notifications
You must be signed in to change notification settings - Fork 754
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
Behaviour change in Task<IDisposable> overload of Observable.Create in version 4.1? #815
Comments
Just to add to this. The OP didnt include an await in the async lambda. I have observed that one not only needs an await, the await needs to complete asynchronously. This wont work:
This is fine:
|
The Looks like there was a mistake in https://github.com/dotnet/reactive/pull/549/files#diff-88bb42c08f322e657242aaba642022feL66 where the rewrite added that |
Interestingly, different overloads behaved differently:
|
When updating from version 4.0 to 4.1, I observed some odd behaviour, which I boiled down to the following:
In our actual code we are calling an async method prior to subscribing to the inner observable, but there's no need to do that in order to reproduce the issue.
In version 4.0, this works perfectly fine, and the value of result is 1.
In 4.1, an InvalidOperationException "Sequence contains no elements" is thrown. This only seems to occur if the inner stream does not complete, i.e. if I replace the
Observable.Range(1, 3)
toObservable.Return(1)
, it works fine.We fixed our code by converting the actual async call we were doing to an observable by using
Observable.FromAsync
, then doing aSelectMany
over that (which is probably a better solution anyway). Surprised to see this behaviour change though. Could this be a bug?The text was updated successfully, but these errors were encountered: