dotnet/reactive · error · ArgumentNullException

throw new ArgumentNullException(nameof(ninth))

Error message

throw new ArgumentNullException(nameof(ninth))

What it means

System.ArgumentNullException raised by the null-guard for the ninth source in a CombineLatest overload in QbservableEx.Homoicon.cs. The guard ensures no null source enters the expression tree handed to the IQbservableProvider.

Solutions

  1. Provide a non-null ninth IQbservable argument.
  2. Use an empty placeholder stream for absent optional sources.
  3. Fix the initialization order so the ninth stream exists before the query is built.
  4. Add a unit test covering the composition call with all sources supplied.

Example fix

// before
var q = CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, null, sel); // ninth null
// after
var ninth = GetNinthStream() ?? provider.CreateQuery<T9>(Expression.Constant(Observable.Empty<T9>()));
var q = CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, ninth, sel);
Defensive patterns

Strategy: validation

Validate before calling

if (s9 == null) s9 = provider.CreateQuery<T9>(Expression.Constant(Observable.Empty<T9>()));

Type guard

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

Try / catch

try { CombineLatest(..., s9, ...); } catch (ArgumentNullException ex) when (ex.ParamName == "ninth") { /* substitute empty source and retry */ }

Prevention

When it happens

Trigger: Invoking the 9+ argument Qbservable.CombineLatest overload with ninth == null at line 912 of the guard chain.

Common situations: A nullable stream from optional configuration; a late-bound service observable that was not registered when the query was composed.

Related errors


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

Appendix: source

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

        {
            if (first == null)
                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,

View on GitHub (pinned to 94b5d5ab91)