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 for IQbservable sequences (System.Reactive/Linq/QbservableEx.Homoicon.cs:496) validates every source argument up front and throws ArgumentNullException when the eleventh IObservable<TEleventh> is null. Qbservable expression trees must be built from non-null source expressions because the provider serializes the whole call into an Expression.Call, so null sources are rejected eagerly rather than failing later during subscription.
Solutions
- Check which argument position is null at the call site (Parameter 'eleventh' = the 11th argument) and fix the expression producing it.
- Replace the null with a non-null sequence such as Observable.Empty<TEleventh>() or a default source from your IQbservableProvider.
- Wrap the source-producing logic so it throws early with a meaningful message instead of returning null.
- Add a Debug.Assert / guard in your own helper that builds the CombineLatest call.
Example fix
// before var result = q1.CombineLatest(q2, ..., q10, GetSource()); // GetSource() returned null // after var src = GetSource() ?? QueryableEx.Empty<TEleventh>(provider); var result = q1.CombineLatest(q2, ..., q10, src);
Defensive patterns
Strategy: validation
Validate before calling
if (eleventh == null) throw new InvalidOperationException("eleventh source must be a non-null IObservable<TEleventh>");
var result = q1.CombineLatest(q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, eleventh); Type guard
static bool IsNonNullSource<T>(IObservable<T> s) => s is not null;
Try / catch
try { var merged = first.CombineLatest(..., eleventh); }
catch (ArgumentNullException ex) when (ex.ParamName == "eleventh") { log.Error("11th CombineLatest source is null"); throw; } Prevention
- Never return null from methods that produce observables - return Observable.Empty instead.
- Validate all source arguments in your own composition helpers before delegating to Rx operators.
- Keep CombineLatest argument counts small; prefer combining collections or nested calls.
- Enable nullable reference types (<Nullable>enable</Nullable>) so null sources are caught at compile time.
When it happens
Trigger: Calling the public static CombineLatest<TFirst..TEleventh>(this IQbservable<TFirst> first, IObservable<TSecond> second, ..., IObservable<TEleventh> eleventh) extension with a null eleventh argument, e.g. when the last sequence is the result of a lookup or a conditional expression that evaluated to null.
Common situations: A helper method returns null instead of Observable.Empty or a Qbservable provider's default; a dictionary/config-driven source lookup misses a key; chaining results where an earlier query returned null instead of throwing.
Related errors
- source
- first
- Value cannot be null. (Parameter 'first')
- Value cannot be null. (Parameter 'second')
- Value cannot be null. (Parameter 'selector')
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/bc60f4cf901ec976.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs:496
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 first.Provider.CreateQuery<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh)>(
Expression.Call(
null,
new Func<IQbservable<TFirst>, IObservable<TSecond>, IObservable<TThird>, IObservable<TFourth>, IObservable<TFifth>, IObservable<TSixth>, IObservable<TSeventh>, IObservable<TEighth>, IObservable<TNinth>, IObservable<TTenth>, IObservable<TEleventh>, IQbservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh)>>(CombineLatest<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth, TTenth, TEleventh>).Method,
first.Expression,
GetSourceExpression(second),
GetSourceExpression(third),
GetSourceExpression(fourth),
GetSourceExpression(fifth),
GetSourceExpression(sixth),
GetSourceExpression(seventh),
GetSourceExpression(eighth),
GetSourceExpression(ninth),
GetSourceExpression(tenth),
GetSourceExpression(eleventh)
)
);View on GitHub (pinned to 94b5d5ab91)