dotnet/reactive · error · ArgumentNullException
Value cannot be null. (Parameter 'fourteenth')
Error message
Value cannot be null. (Parameter 'fourteenth')
What it means
System.Reactive's CombineLatest overload for 14 observable sequences validates every source argument upfront and throws ArgumentNullException when any of them is null. Reactive operators cannot subscribe to a null sequence, so they fail fast at call time rather than producing a broken observable. This particular overload is the 14-source tuple-producing variant (all 14 sources are combined into a named tuple whenever any produces an element).
Solutions
- Ensure the fourteenth argument is a non-null IObservable; if data may be absent, use Observable.Empty<TResult>() or Observable.Return(default) instead of null.
- Null-check all 14 sources before composing the query (assert or throw with a meaningful message of your own).
- Enable nullable reference types (C# 8 <Nullable>enable</Nullable>) so the compiler flags passing possibly-null observables to this API.
Example fix
// before var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14); // where s14 may be null // after IObservable<int> s14Safe = s14 ?? Observable.Empty<int>(); var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14Safe);
Defensive patterns
Strategy: validation
Validate before calling
if (s1 == null || s2 == null || s3 == null || s4 == null || s5 == null || s6 == null || s7 == null || s8 == null || s9 == null || s10 == null || s11 == null || s12 == null || s13 == null || s14 == null)
throw new InvalidOperationException("All 14 CombineLatest sources must be non-null"); Type guard
static bool IsUsableSource<T>(IObservable<T> source) => source is IObservable<T>;
Try / catch
try
{
var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14);
}
catch (ArgumentNullException ex) when (ex.ParamName == "fourteenth")
{
logger.LogError(ex, "14th source stream was null");
} Prevention
- Never return null from methods typed IObservable<T>; return Observable.Empty<T>() instead
- Enable C# nullable reference types so null-passing is a compile-time warning
- Guard all sources once in a helper before composing many-source queries
When it happens
Trigger: Calling Observable.CombineLatest(first, ..., fourteenth) with a null fourteenth argument (the fourteenth IObservable<T> source), e.g. a factory method returning null or an uninitialized field passed as the last of 14 sources.
Common situations: Passing the result of a method that returns null instead of Observable.Empty or Observable.Throw; a dictionary lookup for the 14th stream that missed; nullable reference fields in legacy code that were never checked before composing queries.
Related errors
- Value cannot be null. (Parameter 'subscribe')
- nameof(scheduler)
- nameof(context)
- throw new ArgumentNullException(nameof(source));
- Value cannot be null. (Parameter 'source')
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/9702810cf5cd8ce9.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs:1754
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));
if (twelfth == null)
throw new ArgumentNullException(nameof(twelfth));
if (thirteenth == null)
throw new ArgumentNullException(nameof(thirteenth));
if (fourteenth == null)
throw new ArgumentNullException(nameof(fourteenth));
return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth);
}
/// <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)