Skip to content
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

Observable.FromAsync swallows errors #265

Open
fubar-coder opened this issue Oct 25, 2024 · 0 comments
Open

Observable.FromAsync swallows errors #265

fubar-coder opened this issue Oct 25, 2024 · 0 comments

Comments

@fubar-coder
Copy link

Problem:

It seems that errors thrown from an async/await method are swallowed instead of being received by the subscriber.

Example:

var evt = new AutoResetEvent(false);
Observable.FromAsync(TestAsync)
    .Subscribe(
        _ => "Next".Dump(),
        ex => $"Error {ex}".Dump(),
        _ => { "Completed".Dump(); evt.Set(); });
evt.WaitOne();

async ValueTask TestAsync(CancellationToken ct)
{
    await Task.Delay(TimeSpan.FromMilliseconds(1));
    throw new InvalidOperationException();
}

Expected output:

Error ....etc...
Completed

Actual output:

Completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant