Skip to content

Conversation

@fedeAlterio
Copy link

@fedeAlterio fedeAlterio commented Aug 24, 2025

IAsyncObserver<T> OnNextAsync, OnCompletedAsync and OnErrorAsync can all throw exceptions synchronously,
This is not handled correctly in AsyncObseravableBase, and the execution flow will follow a different path of the asynchronous one.

A concrete issue caused by this, is that if a synchoronous exception is thrown inside OnCompleteAsync, AutoDetachAsyncObserver will not Dispose the subscription automatically

Fixes also reentrancy issues when Disposing while in the middle of an On*Async call

@fedeAlterio fedeAlterio force-pushed the fix/synchronous-exceptions-asyncobservable branch from 83a0b5c to b0a3736 Compare August 24, 2025 12:28
@fedeAlterio fedeAlterio force-pushed the fix/synchronous-exceptions-asyncobservable branch from b0a3736 to f25ab7d Compare August 24, 2025 12:38
@fedeAlterio
Copy link
Author

@idg10 There isn’t an open issue for these problems, but the code comments describe them in detail.
Would you prefer that I create a separate issue to document and track them outside of this PR?

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

Successfully merging this pull request may close these issues.

1 participant