dotnet/reactive · error · ArgumentNullException

source3

Error message

source3

What it means

The 14-source Zip overload checks each input sequence in order; source3 being null triggers ArgumentNullException with parameter name 'source3' at line 863. Rx validates all arguments eagerly so the failure surfaces at the call site rather than during subscription.

Solutions

  1. Pass a valid observable in position 3; use Observable.Empty<TSource3>() if the stream is intentionally absent.
  2. Fix the factory/method that produced the null third source.
  3. Guard with null checks or coalescing for all sources before the call.
  4. Double-check the positional ordering of the 14 source arguments.

Example fix

// before
var zipped = Observable.Zip(s1, s2, null, s4, ..., s14, selector);
// after
var zipped = Observable.Zip(s1, s2, s3 ?? Observable.Empty<TSource3>(), s4, ..., s14, selector);
Defensive patterns

Strategy: validation

Validate before calling

if (source3 == null) throw new ArgumentNullException(nameof(source3));

Type guard

static IObservable<T> NonNull<T>(IObservable<T> s) => s ?? Observable.Empty<T>();

Try / catch

try { var zipped = Observable.Zip(source1, source2, source3, ...); } catch (ArgumentNullException ex) when (ex.ParamName == "source3") { /* substitute default source or abort */ }

Prevention

When it happens

Trigger: Calling the 14-argument Observable.Zip with null as the third IObservable<TSource3> argument.

Common situations: A conditional pipeline that skipped creating the third stream, config-driven stream lookup returning null, or argument misalignment when refactoring the long parameter list.

Related errors


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

Appendix: source

Thrown at Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs:863

        /// <param name="source14">Fourteenth observable source.</param>
        /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
        /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="source1"/> or <paramref name="source2"/> or <paramref name="source3"/> or <paramref name="source4"/> or <paramref name="source5"/> or <paramref name="source6"/> or <paramref name="source7"/> or <paramref name="source8"/> or <paramref name="source9"/> or <paramref name="source10"/> or <paramref name="source11"/> or <paramref name="source12"/> or <paramref name="source13"/> or <paramref name="source14"/> or <paramref name="resultSelector"/> is null.</exception>
        public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult> resultSelector)
        {
            if (source1 == null)
            {
                throw new ArgumentNullException(nameof(source1));
            }

            if (source2 == null)
            {
                throw new ArgumentNullException(nameof(source2));
            }

            if (source3 == null)
            {
                throw new ArgumentNullException(nameof(source3));
            }

            if (source4 == null)
            {
                throw new ArgumentNullException(nameof(source4));
            }

            if (source5 == null)
            {
                throw new ArgumentNullException(nameof(source5));
            }

            if (source6 == null)
            {
                throw new ArgumentNullException(nameof(source6));
            }

            if (source7 == null)

View on GitHub (pinned to 94b5d5ab91)