dotnet/reactive · error · ArgumentNullException

Value cannot be null. (Parameter 'eleventh')

Error message

Value cannot be null. (Parameter 'eleventh')

What it means

The 11-source CombineLatest overload validates each of its arguments and throws ArgumentNullException when the eleventh observable sequence is null. This is a synchronous, fail-fast guard in the public API: the check runs before the implementation object is created. Rx throws rather than silently ignoring a missing source because CombineLatest's output contract depends on all inputs.

Solutions

  1. Assign a valid IObservable<T> instance to the eleventh argument before the call
  2. Replace a possibly-null source with Observable.Empty<T>() or Observable.Never<T>()
  3. Trace the null back to its assignment site with a debugger or null-state analysis (nullable reference types)
  4. Add pre-call validation that names the missing source in your own error message

Example fix

// before
var combined = Observable.CombineLatest(a, b, c, d, e, f, g, h, i, j, maybeEleventh);
// after
if (maybeEleventh == null) throw new InvalidOperationException("eleventh source not configured");
var combined = Observable.CombineLatest(a, b, c, d, e, f, g, h, i, j, maybeEleventh);
Defensive patterns

Strategy: validation

Validate before calling

if (eleventh == null) throw new ArgumentNullException(nameof(eleventh)); // or: eleventh ??= Observable.Empty<T>();

Type guard

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

Try / catch

try { var combined = Observable.CombineLatest(a, b, c, d, e, f, g, h, i, j, k); }
catch (ArgumentNullException ex) when (ex.ParamName == "eleventh") { log.Error("eleventh source was null"); throw; }

Prevention

When it happens

Trigger: Calling Observable.CombineLatest(first, ..., tenth, eleventh) with the eleventh argument null — typically a misassigned variable, a failed factory call, or a conditional that left the last source unassigned.

Common situations: Passing the result of a method that can return null (e.g. FindSequence) directly into the last argument slot; copy-paste of an overload call where the last argument was not updated; dynamic query builders that skip constructing the final source.

Related errors


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

Appendix: source

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

                throw new ArgumentNullException(nameof(second));
            if (third == null)
                throw new ArgumentNullException(nameof(third));
            if (fourth == null)
                throw new ArgumentNullException(nameof(fourth));
            if (fifth == null)
                throw new ArgumentNullException(nameof(fifth));
            if (sixth == null)
                throw new ArgumentNullException(nameof(sixth));
            if (seventh == null)
                throw new ArgumentNullException(nameof(seventh));
            if (eighth == null)
                throw new ArgumentNullException(nameof(eighth));
            if (ninth == null)
                throw new ArgumentNullException(nameof(ninth));
            if (tenth == null)
                throw new ArgumentNullException(nameof(tenth));
            if (eleventh == null)
                throw new ArgumentNullException(nameof(eleventh));

            return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh);
        }

        /// <summary>
        /// Merges the specified observable sequences into one observable sequence of tuple values whenever any of the observable sequences produces an element.
        /// </summary>
        /// <typeparam name="TFirst">The type of the elements in the first source sequence.</typeparam>
        /// <typeparam name="TSecond">The type of the elements in the second source sequence.</typeparam>
        /// <typeparam name="TThird">The type of the elements in the third source sequence.</typeparam>
        /// <typeparam name="TFourth">The type of the elements in the fourth source sequence.</typeparam>
        /// <typeparam name="TFifth">The type of the elements in the fifth source sequence.</typeparam>
        /// <typeparam name="TSixth">The type of the elements in the sixth source sequence.</typeparam>
        /// <typeparam name="TSeventh">The type of the elements in the seventh source sequence.</typeparam>
        /// <typeparam name="TEighth">The type of the elements in the eighth source sequence.</typeparam>
        /// <typeparam name="TNinth">The type of the elements in the ninth source sequence.</typeparam>
        /// <typeparam name="TTenth">The type of the elements in the tenth source sequence.</typeparam>
        /// <typeparam name="TEleventh">The type of the elements in the eleventh source sequence.</typeparam>

View on GitHub (pinned to 94b5d5ab91)