dotnet/reactive · error · InvalidOperationException
The observer is currently processing a notification.
Error message
The observer is currently processing a notification.
What it means
TryEnter uses an Interlocked.CompareExchange state machine and detects re-entrancy: the observer is already Busy processing a previous OnNext/OnError/OnCompleted notification, so a nested or concurrent notification is refused.
Solutions
- Await the previous notification's ValueTask before issuing another one from the same call site.
- Serialize notifications through a queue (e.g. a subject) instead of calling observer methods from multiple contexts.
- Design the observer so its handlers never synchronously call back into the observer.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at AsyncRx.NET/System.Reactive.Async/AsyncObserverBase.cs:76 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/208788987864b681.
Report an issue: GitHub.
Appendix: source
Thrown at AsyncRx.NET/System.Reactive.Async/AsyncObserverBase.cs:76
{
return OnNextAsyncCore(value);
}
finally
{
Interlocked.Exchange(ref _status, Idle);
}
}
protected abstract ValueTask OnNextAsyncCore(T value);
private void TryEnter()
{
var old = Interlocked.CompareExchange(ref _status, Busy, Idle);
switch (old)
{
case Busy:
throw new InvalidOperationException("The observer is currently processing a notification.");
case Done:
throw new InvalidOperationException("The observer has already terminated.");
}
}
}
}
View on GitHub (pinned to 94b5d5ab91)