dotnet/reactive · error · ArgumentNullException
Value cannot be null. (Parameter 'source14')
Error message
Value cannot be null. (Parameter 'source14')
What it means
ArgumentNullException (Parameter 'source14'): the 14th observable argument to the 16-ary Observable.Zip overload is null. The implementation checks every source sequentially and throws with the failing parameter name, so this error pinpoints exactly which slot was null.
Solutions
- Assign a real IObservable<T> to the 14th argument before calling Zip.
- Replace the null with Observable.Empty<T>()/Observable.Never<T>() to encode 'absent'.
- Add a debug-time assertion enumerating all sources for nulls.
- Refactor to the params/IEnumerable Zip overload for variable arity.
Example fix
// before Zip(..., s13, s14 /* null */, s15, ..., sel); // after Zip(..., s13, s14 ?? Observable.Empty<decimal>(), s15, ..., sel);
Defensive patterns
Strategy: validation
Validate before calling
if (source14 == null) throw new ArgumentNullException(nameof(source14)); // or: var s14 = source14 ?? Observable.Never<T14>();
Type guard
static IObservable<T> NonNull<T>(IObservable<T>? o) => o ?? Observable.Empty<T>(); var s14 = NonNull(source14);
Try / catch
try
{
var zipped = Observable.Zip(source1, /* ... */ source14, /* ... */ source16, selector);
}
catch (ArgumentNullException ex) when (ex.ParamName == nameof(source14))
{
logger.LogError(ex, "source14 was null when composing Zip");
} Prevention
- Use factories that guarantee non-null observables for all feature-flag states.
- When growing a zip's arity, update all source variables in the same change.
- Add a debug assertion scanning all zip inputs for nulls in test builds.
- Prefer building sources into a list and using the collection Zip overload.
When it happens
Trigger: Observable.Zip(source1..source16, resultSelector) called with source14 == null, e.g. a nullable backing field, a dictionary TryGetValue path that ignored the miss, or a conditional build of sources leaving a gap.
Common situations: Caching layers returning null on cold start, feature flags removing a stream but leaving the zip arity unchanged, or copy-paste of a 14-source zip where the new source variable was never assigned.
Related errors
- Value cannot be null. (Parameter 'source15')
- Value cannot be null. (Parameter 'source16')
- Value cannot be null. (Parameter 'first')
- Value cannot be null. (Parameter 'source1')
- Value cannot be null. (Parameter 'source2')
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/628ce87ebf726cbe.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs:1159
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 (source15 == null)
{
throw new ArgumentNullException(nameof(source15));
}
if (source16 == null)
{
throw new ArgumentNullException(nameof(source16));
}
if (resultSelector == null)
{
throw new ArgumentNullException(nameof(resultSelector));
}
return s_impl.Zip(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, source16, resultSelector);View on GitHub (pinned to 94b5d5ab91)