dotnet/reactive · error · ArgumentNullException

eleventh

Error message

eleventh

What it means

ArgumentNullException with parameter name 'eleventh' thrown at QbservableEx.Homoicon.cs:2192 by the Zip argument checks. Rx.NET's n-ary Zip validates each source sequence eagerly and throws ArgumentNullException naming the first null slot; here that is the eleventh argument.

Solutions

  1. Pass a non-null eleventh source sequence.
  2. Drop optional sources and use a lower-arity overload (or Zip in stages).
  3. Fix the generator/factory so it emits a real sequence for every slot.
  4. Pre-validate the argument list and log which index is null.

Example fix

// before
var zipped = ZipMany(builder.Sources, selector); // Sources[10] == null
// after
var args = builder.Sources.Select(s => s ?? Observable.Empty<T>().AsQbservable()).ToArray();
var zipped = ZipMany(args, selector);
Defensive patterns

Strategy: validation

Validate before calling

if (args.Length < 11 || args.Take(11).Any(a => a is null))
    throw new InvalidOperationException("Zip requires 11 non-null sources");

Type guard

bool HasElevenSources<TSource>(IQbservable<TSource>?[] xs) => xs.Take(11).All(x => x is not null);

Try / catch

try { /* zip call */ }
catch (ArgumentNullException ex) when (ex.ParamName == "eleventh")
{
    logger.LogError(ex, "Optional source #11 absent");
}

Prevention

When it happens

Trigger: Calling an 11+-ary QbservableEx.Zip where the eleventh source IQbservable is null and the preceding ten are valid.

Common situations: Dynamically generated Zip calls (code generation, expression builders) that emit placeholders for optional sources; merging streams where one remote queryable endpoint failed to produce a sequence object; unassigned fields in large orchestration setup code.

Related errors


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

Appendix: source

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

                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));
            if (ninth == null)
                throw new ArgumentNullException(nameof(ninth));
            if (tenth == null)
                throw new ArgumentNullException(nameof(tenth));
            if (eleventh == null)
                throw new ArgumentNullException(nameof(eleventh));
            if (twelfth == null)
                throw new ArgumentNullException(nameof(twelfth));
            if (thirteenth == null)
                throw new ArgumentNullException(nameof(thirteenth));
            if (fourteenth == null)
                throw new ArgumentNullException(nameof(fourteenth));
            if (fifteenth == null)
                throw new ArgumentNullException(nameof(fifteenth));
            if (sixteenth == null)
                throw new ArgumentNullException(nameof(sixteenth));

            return first.Provider.CreateQuery<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh, TTwelfth Twelfth, TThirteenth Thirteenth, TFourteenth Fourteenth, TFifteenth Fifteenth, TSixteenth Sixteenth)>(
                Expression.Call(
                    null,
                    new Func<IQbservable<TFirst>, IObservable<TSecond>, IObservable<TThird>, IObservable<TFourth>, IObservable<TFifth>, IObservable<TSixth>, IObservable<TSeventh>, IObservable<TEighth>, IObservable<TNinth>, IObservable<TTenth>, IObservable<TEleventh>, IObservable<TTwelfth>, IObservable<TThirteenth>, IObservable<TFourteenth>, IObservable<TFifteenth>, IObservable<TSixteenth>, IQbservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh, TTwelfth Twelfth, TThirteenth Thirteenth, TFourteenth Fourteenth, TFifteenth Fifteenth, TSixteenth Sixteenth)>>(Zip<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth, TTenth, TEleventh, TTwelfth, TThirteenth, TFourteenth, TFifteenth, TSixteenth>).Method,
                    first.Expression,
                    GetSourceExpression(second),
                    GetSourceExpression(third),

View on GitHub (pinned to 94b5d5ab91)