{"record":{"id":"208788987864b681","repo":"dotnet/reactive","slug":"the-observer-is-currently-processing-a-notification","errorCode":null,"errorMessage":"The observer is currently processing a notification.","messagePattern":"The observer is currently processing a notification\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"AsyncRx.NET/System.Reactive.Async/AsyncObserverBase.cs","lineNumber":76,"sourceCode":"            {\n                return OnNextAsyncCore(value);\n            }\n            finally\n            {\n                Interlocked.Exchange(ref _status, Idle);\n            }\n        }\n\n        protected abstract ValueTask OnNextAsyncCore(T value);\n\n        private void TryEnter()\n        {\n            var old = Interlocked.CompareExchange(ref _status, Busy, Idle);\n\n            switch (old)\n            {\n                case Busy:\n                    throw new InvalidOperationException(\"The observer is currently processing a notification.\");\n                case Done:\n                    throw new InvalidOperationException(\"The observer has already terminated.\");\n            }\n        }\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":83,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/AsyncRx.NET/System.Reactive.Async/AsyncObserverBase.cs#L58-L83","documentation":"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.","triggerScenarios":"Thrown at AsyncRx.NET/System.Reactive.Async/AsyncObserverBase.cs:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}