dotnet/reactive · error · ArgumentNullException
Value cannot be null. (Parameter 'thirteenth')
Error message
Value cannot be null. (Parameter 'thirteenth')
What it means
The 13-source Qbservable.Zip overload throws ArgumentNullException naming 'thirteenth' when the last source sequence is null. The check at line 1929 is the final guard before building the expression tree; without it, the null would surface as a confusing failure inside CreateQuery or the provider.
Solutions
- Supply a valid IObservable<TThirteenth> for the thirteenth argument
- Use Observable.Empty<TThirteenth>() as a null-safe default when the source is absent
- Fix the producer so it never returns a null sequence
Example fix
// before var zipped = QbservableEx.Zip(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth /* null */); // after if (thirteenth == null) thirteenth = Observable.Empty<TThirteenth>(); var zipped = QbservableEx.Zip(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth);
Defensive patterns
Strategy: validation
Validate before calling
if (thirteenth is null) thirteenth = Observable.Empty<TThirteenth>();
Type guard
bool hasThirteenth = thirteenth is not null;
Try / catch
try
{
var zipped = QbservableEx.Zip(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth);
}
catch (ArgumentNullException ex)
{
logger.LogError("Zip failed: parameter {Param} was null", ex.ParamName);
throw;
} Prevention
- Guard optional trailing sources with ?? Observable.Empty<T>() before composition
- Never let configuration-driven lookups yield null sequences
- Write a composition helper that normalizes all sources in one place
When it happens
Trigger: Calling QbservableEx.Zip(first..thirteenth) with thirteenth == null.
Common situations: Optional trailing source in a programmatically assembled query; null returned by a lookup/factory for the final stream in a 13-way merge.
Related errors
- throw new ArgumentNullException(nameof(first))
- throw new ArgumentNullException(nameof(resultSelector))
- throw new ArgumentNullException(nameof(second))
- throw new ArgumentNullException(nameof(sources))
- Value cannot be null. (Parameter 'fourteenth')
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/2ba722555894cc8b.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs:1929
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));
if (twelfth == null)
throw new ArgumentNullException(nameof(twelfth));
if (thirteenth == null)
throw new ArgumentNullException(nameof(thirteenth));
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, TTwelfth Twelfth, TThirteenth Thirteenth)>(
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>, IObservable<TTwelfth>, IObservable<TThirteenth>, IQbservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh, TTwelfth Twelfth, TThirteenth Thirteenth)>>(Zip<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth, TTenth, TEleventh, TTwelfth, TThirteenth>).Method,
first.Expression,
GetSourceExpression(second),
GetSourceExpression(third),
GetSourceExpression(fourth),
GetSourceExpression(fifth),
GetSourceExpression(sixth),
GetSourceExpression(seventh),
GetSourceExpression(eighth),
GetSourceExpression(ninth),
GetSourceExpression(tenth),
GetSourceExpression(eleventh),
GetSourceExpression(twelfth),
GetSourceExpression(thirteenth)View on GitHub (pinned to 94b5d5ab91)