dotnet/reactive · error · ArgumentNullException
Value cannot be null. (Parameter 'source14')
Error message
Value cannot be null. (Parameter 'source14')
What it means
The CombineLatest overload combining 14 source sequences validates each argument eagerly. When the 14th IObservable<TSource14> argument is null, it throws ArgumentNullException naming 'source14'. Rx's convention is synchronous fail-fast: the exception surfaces at the CombineLatest call itself, not during subscription.
Solutions
- Ensure the value passed as source14 is a real, non-null IObservable<TSource14>.
- Use Observable.Empty<TSource14>() or a replayed/subject-based default for an optional final stream instead of null.
- Validate all sources before the call (e.g. a guarded factory method that throws with a clearer message).
Example fix
// before var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, finalStream, sel); // after var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, finalStream ?? Observable.Empty<Stream14>(), sel);
Defensive patterns
Strategy: validation
Validate before calling
if (source14 == null) source14 = Observable.Empty<Stream14>(); var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, source14, selector);
Type guard
bool HasStream<T>(IObservable<T> s) => s is not null;
Try / catch
try
{
var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, source14, selector);
}
catch (ArgumentNullException ex) when (ex.ParamName == "source14")
{
logger.LogError(ex, "14th CombineLatest source was null");
} Prevention
- Review the last arguments of long overloads carefully — they are the most commonly missed.
- Default optional final streams to Observable.Empty<T>() at the point of acquisition.
- Add unit tests that exercise the combination with every stream provided.
When it happens
Trigger: Calling Observable.CombineLatest with 14 sources and passing null as the last source (source14), e.g. from an unassigned variable, a nullable field, or a factory that returned null for the final stream.
Common situations: The last argument is easy to miss when a long argument list is edited; adding a 15th argument or trimming an overload call and misplacing a null; a conditional stream that defaulted to null instead of Observable.Empty.
Related errors
- Value cannot be null. (Parameter 'source10')
- Value cannot be null. (Parameter 'source')
- Value cannot be null. (Parameter 'scheduler')
- Value cannot be null. (Parameter 'observer')
- comparer
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/57b98eca2249967b.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs:930
if (source11 == null)
{
throw new ArgumentNullException(nameof(source11));
}
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 (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, 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)