dotnet/reactive · error · ArgumentNullException
Value cannot be null. (Parameter 'source8')
Error message
Value cannot be null. (Parameter 'source8')
What it means
The 8-source CombineLatest overload validates all eight sources plus resultSelector, throwing ArgumentNullException for the first null. Here source8 was null, so the guard at line 339 fired. Note the final overload is checked before resultSelector, so a null selector would be reported separately.
Solutions
- Provide a non-null eighth observable, using Observable.Empty<T8>() or Observable.Never<T8>() when absence is legitimate.
- Add a null check on source8 at the call site.
- Fix the code path that leaves source8 unassigned.
- After adding/removing sources, recheck the full argument list against the parameter names.
Example fix
// before var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, sel); // s8 == null // after var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8 ?? Observable.Never<T8>(), sel);
Defensive patterns
Strategy: validation
Validate before calling
if (source8 == null) source8 = Observable.Never<TSource8>(); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector));
Type guard
static bool Complete(IObservable<T8> s8, Func<...> sel) => s8 is not null && sel is not null;
Try / catch
try
{
var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, sel);
}
catch (ArgumentNullException ex) when (ex.ParamName == "source8")
{
// supply the missing eighth stream, then recompose
} Prevention
- When adding sources to a composition, recheck every slot including the last
- Never return null from wrapper methods that promise IObservable<T>
- Default uninitialized streams to Observable.Never in constructors
- Run nullable reference type analysis to catch unset observables
When it happens
Trigger: Calling Observable.CombineLatest with null in the eighth source slot — e.g. the last stream of a fixed-width composition that was conditionally created.
Common situations: Last observable in a generated/pipeline-composed set not initialized; null returned by a wrapper method for the final stream; positional-argument mix-ups when adding the eighth source during refactoring.
Related errors
- Value cannot be null. (Parameter 'onCompletedAsync')
- Value cannot be null. (Parameter 'onNext')
- Value cannot be null. (Parameter 'onError')
- ArgumentNullException(nameof(onError))
- ArgumentNullException(nameof(onCompleted))
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/c932c5fb39e0eee1.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs:339
if (source5 == null)
{
throw new ArgumentNullException(nameof(source5));
}
if (source6 == null)
{
throw new ArgumentNullException(nameof(source6));
}
if (source7 == null)
{
throw new ArgumentNullException(nameof(source7));
}
if (source8 == null)
{
throw new ArgumentNullException(nameof(source8));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, 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)