dotnet/reactive · error · ArgumentNullException

source8

Error message

source8

What it means

The 14-source Zip overload validates source8 at line 888; null triggers ArgumentNullException with parameter 'source8'. Rx eagerly validates arguments in the public API so a null eighth input fails at the call site, before any subscription.

Solutions

  1. Pass a valid observable (or Observable.Empty<TSource8>()) in position 8.
  2. Fix the null-producing code path for source8.
  3. Null-check each source before the Zip call.
  4. Re-verify positional ordering of the 14 arguments.

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling the 14-argument Observable.Zip with null in the eighth argument position while other sources and resultSelector are non-null.

Common situations: A dictionary/config lookup missing the key for the eighth stream, a factory method returning null on a failure path, or argument drift when editing the long parameter list.

Related errors


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

Appendix: source

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

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

            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)

View on GitHub (pinned to 94b5d5ab91)