dotnet/reactive · error · ArgumentNullException

source12

Error message

source12

What it means

System.ArgumentNullException thrown by the 14-source public Zip overload in Observable.Multiple.Zip.cs when the twelfth source sequence (source12) is null. Each Zip input must be a valid IObservable so the operator can subscribe and buffer elements pairwise; null inputs are rejected eagerly at operator-creation time. This is standard Rx argument validation, thrown before any subscription happens.

Solutions

  1. Initialize source12 to a valid observable before the Zip call.
  2. Use Observable.Empty<T>() to represent an intentionally absent stream.
  3. Add an explicit null guard for source12 before the call to get a stack trace at your code.
  4. Move to the collection-based Zip overload and filter/assert nulls in the collection first.

Example fix

// before
var zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, selector); // s12 == null
// after
ArgumentNullException.ThrowIfNull(s12);
var zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, selector);
Defensive patterns

Strategy: validation

Validate before calling

if (s12 is null) throw new ArgumentNullException(nameof(s12));

Type guard

static bool IsValidSource<T>(IObservable<T>? s) => s is not null;

Try / catch

try { var zipped = Observable.Zip(s1, ..., s12, ..., s14, selector); } catch (ArgumentNullException ex) when (ex.ParamName == "source12") { // replace null source with Observable.Empty<T>() }

Prevention

When it happens

Trigger: Calling Observable.Zip(s1, ..., s12, ..., s14, resultSelector) with the twelfth argument set to a null IObservable reference.

Common situations: A merged telemetry stream that was conditionally assigned and left null; wiring many sources from a config file where one key was missing and the lookup returned null; code-generation or templating that emitted a null argument placeholder.

Related errors


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

Appendix: source

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

            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)
            {
                throw new ArgumentNullException(nameof(source13));
            }

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

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

            return s_impl.Zip(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector);

View on GitHub (pinned to 94b5d5ab91)