dotnet/reactive · error · ArgumentNullException

throw new ArgumentNullException(nameof(tenth))

Error message

throw new ArgumentNullException(nameof(tenth))

What it means

System.ArgumentNullException raised by the null-guard for the tenth source in a CombineLatest overload in QbservableEx.Homoicon.cs. Very high-arity overloads (10-16 sources) check every argument in sequence; the tenth slot received null.

Solutions

  1. Supply a valid tenth IQbservable argument.
  2. If one stream is optional, merge in an empty default stream instead of null.
  3. Refactor to combine sources incrementally (pairs) so each call is small and readable.
  4. Audit the stream factory responsible for the tenth source.

Example fix

// before
CombineLatest(s1,s2,s3,s4,s5,s6,s7,s8,s9, tenthStream, sel); // tenthStream == null
// after
tenthStream ??= provider.CreateQuery<T10>(Expression.Constant(Observable.Empty<T10>()));
CombineLatest(s1,s2,s3,s4,s5,s6,s7,s8,s9, tenthStream, sel);
Defensive patterns

Strategy: validation

Validate before calling

if (s10 == null) throw new ArgumentException("tenth source must be provided", nameof(s10));

Type guard

static bool IsNonNullSource<T>(IQbservable<T> s) => s != null;

Try / catch

try { CombineLatest(..., s10, ...); } catch (ArgumentNullException ex) when (ex.ParamName == "tenth") { /* rebuild query with default tenth source */ }

Prevention

When it happens

Trigger: Invoking the 10+ argument Qbservable.CombineLatest overload with tenth == null at line 914 of the guard chain.

Common situations: Building mega-queries over many telemetry streams where one stream provider returned null; copy-paste errors in long argument lists where the tenth slot was left as placeholder null.

Related errors


AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15). Data as JSON: /api/errors/7117867ecbda59cd. Report an issue: GitHub.

Appendix: source

Thrown at Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs:914

                throw new ArgumentNullException(nameof(first));
            if (second == null)
                throw new ArgumentNullException(nameof(second));
            if (third == null)
                throw new ArgumentNullException(nameof(third));
            if (fourth == null)
                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));
            if (fourteenth == null)
                throw new ArgumentNullException(nameof(fourteenth));
            if (fifteenth == null)
                throw new ArgumentNullException(nameof(fifteenth));
            if (sixteenth == null)
                throw new ArgumentNullException(nameof(sixteenth));

            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, TFourteenth Fourteenth, TFifteenth Fifteenth, TSixteenth Sixteenth)>(
                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>, IObservable<TFourteenth>, IObservable<TFifteenth>, IObservable<TSixteenth>, 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, TFourteenth Fourteenth, TFifteenth Fifteenth, TSixteenth Sixteenth)>>(CombineLatest<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth, TTenth, TEleventh, TTwelfth, TThirteenth, TFourteenth, TFifteenth, TSixteenth>).Method,
                    first.Expression,

View on GitHub (pinned to 94b5d5ab91)