dotnet/reactive · error · ArgumentNullException

Value cannot be null. (Parameter 'fifteenth')

Error message

Value cannot be null. (Parameter 'fifteenth')

What it means

System.Reactive's Qbservable.Zip overload for 15 sources validates every argument up front and throws ArgumentNullException when any source sequence is null. Qbservable operators build an expression tree via first.Provider.CreateQuery, so a null argument cannot be represented in the expression and is rejected eagerly at call time rather than at subscription time. The parameter name in the message ('fifteenth') identifies exactly which source was null.

Solutions

  1. Ensure the fifteenth argument passed to Zip is a non-null IObservable<TFifteenth> (e.g. Observable.Empty<TFifteenth>() instead of null)
  2. Check where the fifteenth sequence is produced and fix the code returning null
  3. Guard with ?? Observable.Empty<T>() if a null source is legitimately possible
  4. Validate all arguments before calling Zip in dynamic scenarios

Example fix

// before
var zipped = first.Zip(second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth!);
// after
var safe15 = fifteenthSource ?? Observable.Empty<TFifteenth>();
var zipped = first.Zip(second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, safe15);
Defensive patterns

Strategy: validation

Validate before calling

var sources = new IObservable<object>[] { second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth };
if (sources.Any(s => s == null)) throw new InvalidOperationException("All 15 Zip sources must be non-null");

Try / catch

try { var zipped = first.Zip(..., fourteenth, fifteenth); }
catch (ArgumentNullException ex) when (ex.ParamName == "fifteenth") { /* substitute Observable.Empty<TFifteenth>() and retry */ }

Prevention

When it happens

Trigger: Calling the 15-source QbservableEx.Zip extension with the fifteenth IObservable<TFifteenth> argument null while the other fourteen are non-null sequences.

Common situations: Building Zip sources from a collection or factory where the last entry is missing/null; optional integrations whose observable is null when disabled; copy-paste of multi-source Zip calls that omits the final source.

Related errors


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

Appendix: source

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

                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));

            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)>(
                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>, 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)>>(Zip<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth, TTenth, TEleventh, TTwelfth, TThirteenth, TFourteenth, TFifteenth>).Method,
                    first.Expression,
                    GetSourceExpression(second),
                    GetSourceExpression(third),
                    GetSourceExpression(fourth),
                    GetSourceExpression(fifth),
                    GetSourceExpression(sixth),
                    GetSourceExpression(seventh),
                    GetSourceExpression(eighth),
                    GetSourceExpression(ninth),
                    GetSourceExpression(tenth),
                    GetSourceExpression(eleventh),
                    GetSourceExpression(twelfth),
                    GetSourceExpression(thirteenth),

View on GitHub (pinned to 94b5d5ab91)