dotnet/reactive · error · ArgumentNullException

source9

Error message

source9

What it means

The 14-source Zip overload validates source9 at line 893; a null ninth sequence throws ArgumentNullException with parameter 'source9'. All 14 inputs must be non-null observable sequences for Zip to combine elements positionally, and Rx validates them synchronously in the public method.

Solutions

  1. Supply a real observable for position 9; use Observable.Empty<TSource9>() as a placeholder for an absent stream.
  2. Fix the producer that returned null for source9.
  3. Add pre-call validation that every source is non-null.
  4. Check the ordering of all 14 source arguments at the call site.

Example fix

// before
var zipped = Observable.Zip(s1, ..., s8, null, s10, ..., s14, selector);
// after
var zipped = Observable.Zip(s1, ..., s8, s9 ?? Observable.Empty<TSource9>(), s10, ..., s14, selector);
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling the 14-argument Observable.Zip with null as the ninth IObservable<TSource9> argument while the other 13 sources and the resultSelector are non-null.

Common situations: An uninitialized stream variable for the ninth feed, a null returned from a conditional factory branch, or misordered arguments when refactoring the very long call signature.

Related errors


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

Appendix: source

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

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

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

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

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

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

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

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

            if (source13 == null)

View on GitHub (pinned to 94b5d5ab91)