dotnet/reactive · error · ArgumentNullException

fourteenth

Error message

fourteenth

What it means

The 16-argument overload of QbservableEx.Zip throws ArgumentNullException because the parameter 'fourteenth' (the fourteenth source observable sequence) was null. Rx operators validate all sequence arguments eagerly before building the query expression tree, so a null source fails immediately on the client rather than on the provider.

Solutions

  1. Initialize the fourteenth observable before calling Zip (e.g. Observable.Empty<TFourteenth>() or a real source)
  2. Check each of the 16 arguments for null before invoking Zip
  3. Trace which stream factory returned null and fix it at the source

Example fix

// before
var q = first.Zip(s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16); // s14 null
// after
IObservable<TFourteenth> s14 = GetFourteenth() ?? Observable.Empty<TFourteenth>();
var q = first.Zip(s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16);
Defensive patterns

Strategy: validation

Validate before calling

if (first == null || second == null || ... || sixteenth == null) throw new ArgumentException("All Zip sources must be non-null");

Type guard

static bool AllNonNull<T>(params object[] sources) => sources.All(s => s != null);

Try / catch

try { var q = first.Zip(...s16); } catch (ArgumentNullException ex) { Console.Error.WriteLine($"Zip source missing: {ex.ParamName}"); }

Prevention

When it happens

Trigger: Calling the 16-way Zip overload of IQbservable with the fourteenth argument (an IObservable<TFourteenth> source) set to null, e.g. passing an uninitialized field or the result of a lookup that returned null.

Common situations: Chaining many 16 observable streams in a WPF/Silverlight data-binding scenario where one stream comes from a service that returned null instead of an empty sequence; refactoring that removed a stream assignment; using a dictionary of streams where one key is missing.

Related errors


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

Appendix: source

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

                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),
                    GetSourceExpression(fourth),
                    GetSourceExpression(fifth),
                    GetSourceExpression(sixth),
                    GetSourceExpression(seventh),
                    GetSourceExpression(eighth),
                    GetSourceExpression(ninth),

View on GitHub (pinned to 94b5d5ab91)