dotnet/reactive · error · ArgumentNullException

Value cannot be null. (Parameter 'source10')

Error message

Value cannot be null. (Parameter 'source10')

What it means

Thrown by the public CombineLatest overload when the tenth source sequence ('source10') is null. This is the last source argument validated before the result selector; the ArgumentNullException names 'source10' and is thrown eagerly at the call site. It signals a null was supplied where a source IObservable was required.

Solutions

  1. Supply a non-null observable; use Observable.Empty<T>()/Never<T>() if the stream is legitimately absent.
  2. Fix the initialization or lookup that produced the null for source10.
  3. Add a pre-call null check across all sources with a descriptive exception.
  4. Consider grouping sources into an array and using the collection-based CombineLatest overload.

Example fix

// before
var agg = Observable.CombineLatest(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) => ...);
// after
var agg = Observable.CombineLatest(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ?? Observable.Empty<Item>(), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) => ...);
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try { var agg = Observable.CombineLatest(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, selector); }
catch (ArgumentNullException ex) when (ex.ParamName == "source10") { log.Error("aggregation source 10 is null"); }

Prevention

When it happens

Trigger: Observable.CombineLatest with 10 sources and a result selector, where the tenth IObservable argument is null.

Common situations: Ten-input merges (dashboard aggregations) where the last stream came from a nullable dependency; copy-paste argument lists where one slot retained a null placeholder.

Related errors


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

Appendix: source

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

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

            return s_impl.CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, 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)