dotnet/reactive · error · ArgumentNullException

eighth

Error message

eighth

What it means

This ArgumentNullException is thrown by the Qbservable.CombineLatest 8-source overload when the eighth source sequence (eighth) is null. Qbservable.CombineLatest builds an expression tree for the remote/provider query, so every source must be a real observable; a null source would make the Expression.Call tree invalid. The library eagerly validates all arguments synchronously before creating the query.

Solutions

  1. Pass a valid non-null IObservable<TEighth> as the eighth argument
  2. If the eighth source may legitimately be absent, substitute Observable.Empty<TEighth>() or a default sequence instead of null
  3. Check the producer of the eighth sequence (factory/lookup) to find why it returned null
  4. Catch ArgumentNullException and report which argument (ParamName == "eighth") was null for diagnostics

Example fix

// before
var q = Observable.CombineLatest(q1, o2, o3, o4, o5, o6, o7, GetEighthStream()); // GetEighthStream() returned null
// after
var eighth = GetEighthStream() ?? Observable.Empty<EighthType>();
var q = Observable.CombineLatest(q1, o2, o3, o4, o5, o6, o7, eighth);
Defensive patterns

Strategy: validation

Validate before calling

if (q1 is null || o2 is null || o3 is null || o4 is null || o5 is null || o6 is null || o7 is null || eighth is null)
    throw new ArgumentException("All CombineLatest sources must be non-null");

Type guard

static bool IsNonNullSource<T>(IObservable<T>? s) => s is not null;

Try / catch

try
{
    var q = q1.CombineLatest(o2, o3, o4, o5, o6, o7, eighth);
}
catch (ArgumentNullException ex) when (ex.ParamName == "eighth")
{
    logger.LogError(ex, "eighth source of CombineLatest is null");
}

Prevention

When it happens

Trigger: Calling QbservableEx.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth) on an IQbservable<TFirst> provider with eighth passed as a null IObservable<TEighth>, e.g. when the eighth sequence comes from a method, dictionary lookup, or conditional expression that returned null.

Common situations: Common when one source is built from a factory or config that can return null (e.g. a sensor stream that failed to initialize), when refactoring added a new source argument and left it unfilled, or when combining sequences stored in an array/collection where one slot was never populated.

Related errors


AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15). Data as JSON: /api/errors/e705e0362f9fc721. Report an issue: GitHub.

Appendix: source

Thrown at Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs:298

        /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="third" /> or <paramref name="fourth" /> or <paramref name="fifth" /> or <paramref name="sixth" /> or <paramref name="seventh" /> or <paramref name="eighth" /> is null.</exception>
        public static IQbservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth)> CombineLatest<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth>(this IQbservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth, IObservable<TSeventh> seventh, IObservable<TEighth> eighth)
        {
            if (first == null)
                throw new ArgumentNullException(nameof(first));
            if (second == null)
                throw new ArgumentNullException(nameof(second));
            if (third == null)
                throw new ArgumentNullException(nameof(third));
            if (fourth == null)
                throw new ArgumentNullException(nameof(fourth));
            if (fifth == null)
                throw new ArgumentNullException(nameof(fifth));
            if (sixth == null)
                throw new ArgumentNullException(nameof(sixth));
            if (seventh == null)
                throw new ArgumentNullException(nameof(seventh));
            if (eighth == null)
                throw new ArgumentNullException(nameof(eighth));

            return first.Provider.CreateQuery<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth)>(
                Expression.Call(
                    null,
                    new Func<IQbservable<TFirst>, IObservable<TSecond>, IObservable<TThird>, IObservable<TFourth>, IObservable<TFifth>, IObservable<TSixth>, IObservable<TSeventh>, IObservable<TEighth>, IQbservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth)>>(CombineLatest<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth>).Method,
                    first.Expression,
                    GetSourceExpression(second),
                    GetSourceExpression(third),
                    GetSourceExpression(fourth),
                    GetSourceExpression(fifth),
                    GetSourceExpression(sixth),
                    GetSourceExpression(seventh),
                    GetSourceExpression(eighth)
                )
            );
        }

        /// <summary>

View on GitHub (pinned to 94b5d5ab91)