<PackageReference Include="System.Reactive" Version="6.1.0-preview.9" />

ExceptionHelper

static class ExceptionHelper
Utility methods to handle lock-free combining of Exceptions as well as hosting a terminal-exception indicator for lock-free termination support.
public static Exception Terminated { get; }

The singleton instance of the exception indicating a terminal state, DO NOT LEAK or signal this via OnError!

public static bool TrySetException(ref Exception field, Exception ex)

Tries to atomically set the Exception on the given field if it is still null.