dotnet/reactive · error · ArgumentNullException

Value cannot be null. (Parameter 'source15')

Error message

Value cannot be null. (Parameter 'source15')

What it means

The 15-way CombineLatest overload validates every source; this message indicates source15 (the fifteenth input) was null at operator assembly. Fix: check all fifteen arguments; the null one is the fifteenth observable.

Solutions

  1. Pass a non-null observable for source15 or default to Observable.Empty<T15>()/Never<T15>().
  2. Fix the code path that should produce the 15th stream.
  3. Recount arguments: with 15 positional sources it is easy to misalign by one, pushing null into the last slot.
  4. Consider restructuring into fewer combined observables for maintainability.

Example fix

// before
CombineLatest(s1..s14, doneStream, sel) // doneStream null
// after
var s15 = doneStream ?? Observable.Never<T15>();
CombineLatest(s1..s14, s15, sel);
Defensive patterns

Strategy: validation

Validate before calling

if (source15 == null) source15 = Observable.Empty<T15>();
System.Diagnostics.Debug.Assert(source15 != null, "source15 must be provided");

Type guard

bool IsPresent<T>(IObservable<T> o) => o is not null;

Try / catch

try { return Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, selector); }
catch (ArgumentNullException ex) when (ex.ParamName == "source15") { log.Error("source15 observable was null"); throw; }

Prevention

When it happens

Trigger: Calling public Observable.CombineLatest(source1..source15, resultSelector) with null as the source15 argument.

Common situations: Trailing argument left null in a manually extended call; a completion/teardown stream that's null before shutdown logic runs; last argument mistakenly left off and a null shifted into position 15.

Related errors


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

Appendix: source

Thrown at Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs:1053

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

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

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

        /// <summary>
        /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
        /// </summary>
        /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
        /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
        /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
        /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
        /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>

View on GitHub (pinned to 94b5d5ab91)