The application has the following definition
IDisposable IObservable<X>.Subscribe<X>(Action<X> onNext)
It was passed an async function:
async Task Process(X notification, CancellationToken ct) {...}
source.Subscribe(async x => await Process(x, CancellationToken.None)); // Warning
However, ReSharper warns "avoid using 'async' lambda when delegate type returns 'void'", because the exception raised in Process will not be caught with Catch.
The following code doesn't have any warning. However, I heard using Wait()
is usually a bad code smell?
source.Subscribe(x => Process(x, CancellationToken.None).Wait());