.NET Reactive framework: ReplaySubject OnError: why does it throw an exception?

Note. I mean the version of RX.NET 4.

I am using the ReplaySubject class for RX. I raise OnError with exception as parameter.

I expected it to notify all OnError subscribers and pass them an exception, instead it just throws an exception, and after that the exception is simply not handled.

The code is very simple, you can see the code on GitHub. https://github.com/arielbh/CodeCommander/blob/master/CodeValue.CodeCommander/CommandBase.cs Line 117 is an OnNext call.

Any ideas? Obviously, I want the behavior that I expect to happen. Thanks

Ariel

+3
source share
2 answers

. , , .

    public static void SendOnError<T, E>(this IObserver<T> Subject, E ExceptionToSend) where E : Exception
    {
        try { Subject?.OnError(ExceptionToSend); }
        catch (E exception)
        {
            Debug.WriteLine("One or more subscribers to the subject did not implement an OnError handler. Ignoring rethrown exception: " + exception.Message);
        }
    }
0

All Articles