Skip to content

WhenAnyValue - how to ensure the order of async subscriber? #3710

Answered by sinatrocious
sinatrocious asked this question in Q&A
Discussion options

You must be logged in to vote

@anaisbetts, async void is the problem indeed. I've seen your answer in SO topic, where Stephen Cleary explains it ;)

I will use SubscribeAsync in place of Subscribe:

public static IDisposable SubscribeAsync<T>(this IObservable<T> source, Func<T, Task> func) =>
            source.Select(o => Observable.FromAsync(_ => func(o)))
                .Concat()
                .Subscribe();

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@glennawatson
Comment options

@sinatrocious
Comment options

@anaisbetts
Comment options

@sinatrocious
Comment options

Answer selected by sinatrocious
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants