{"record":{"id":"f032e9639989d2c2","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-first-observable-multiple","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'first')","messagePattern":"Value cannot be null\\. \\(Parameter 'first'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1443,"sourceCode":"        /// <typeparam name=\"TSixth\">The type of the elements in the sixth source sequence.</typeparam>\n        /// <typeparam name=\"TSeventh\">The type of the elements in the seventh source sequence.</typeparam>\n        /// <typeparam name=\"TEighth\">The type of the elements in the eighth source sequence.</typeparam>\n        /// <typeparam name=\"TNinth\">The type of the elements in the ninth source sequence.</typeparam>\n        /// <param name=\"first\">First observable source.</param>\n        /// <param name=\"second\">Second observable source.</param>\n        /// <param name=\"third\">Third observable source.</param>\n        /// <param name=\"fourth\">Fourth observable source.</param>\n        /// <param name=\"fifth\">Fifth observable source.</param>\n        /// <param name=\"sixth\">Sixth observable source.</param>\n        /// <param name=\"seventh\">Seventh observable source.</param>\n        /// <param name=\"eighth\">Eighth observable source.</param>\n        /// <param name=\"ninth\">Ninth observable source.</param>\n        /// <returns>An observable sequence containing the result of combining elements of the sources using tuple values.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"first\"/> or <paramref name=\"second\"/> or <paramref name=\"third\"/> or <paramref name=\"fourth\"/> or <paramref name=\"fifth\"/> or <paramref name=\"sixth\"/> or <paramref name=\"seventh\"/> or <paramref name=\"eighth\"/> or <paramref name=\"ninth\"/> is null.</exception>\n        public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth)> CombineLatest<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth, IObservable<TSeventh> seventh, IObservable<TEighth> eighth, IObservable<TNinth> ninth)\n        {\n            if (first == null)\n                throw new ArgumentNullException(nameof(first));\n            if (second == null)\n                throw new ArgumentNullException(nameof(second));\n            if (third == null)\n                throw new ArgumentNullException(nameof(third));\n            if (fourth == null)\n                throw new ArgumentNullException(nameof(fourth));\n            if (fifth == null)\n                throw new ArgumentNullException(nameof(fifth));\n            if (sixth == null)\n                throw new ArgumentNullException(nameof(sixth));\n            if (seventh == null)\n                throw new ArgumentNullException(nameof(seventh));\n            if (eighth == null)\n                throw new ArgumentNullException(nameof(eighth));\n            if (ninth == null)\n                throw new ArgumentNullException(nameof(ninth));\n\n            return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);","sourceCodeStart":1425,"sourceCodeEnd":1461,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1425-L1461","documentation":"This is the tuple-returning nine-source CombineLatest overload; it checks every source argument up front and throws ArgumentNullException naming 'first' when the first observable is null. Rx treats null sequences as caller bugs and fails immediately at composition rather than at subscription. The XML docs on the method explicitly list 'first' among parameters that must not be null.","triggerScenarios":"Calling Observable.CombineLatest<TFirst,...,TNinth>(first,...,ninth) with first == null, usually when the primary stream comes from a service, cache, or config that returned null.","commonSituations":"Combining UI state streams where the primary view-model stream was not yet created; dependency-injection containers yielding null for an unregistered service; migration code that reordered arguments and shifted a null into the first slot.","solutions":["Initialize/pass a real IObservable<T> for the first argument before combining","Coalesce with Observable.Empty<T>() or Observable.Never<T>() if absence is legitimate","Fix the factory or DI registration that produced the null first stream","Reorder or restructure to use the array-based overload when the argument list is built dynamically"],"exampleFix":"// before\nvar zipped = firstStream.CombineLatest(secondStream, thirdStream, /* ... */); // firstStream == null\n// after\nvar stream = firstStream ?? Observable.Empty<WindowState>();\nvar zipped = stream.CombineLatest(secondStream, thirdStream, /* ... */);","handlingStrategy":"validation","validationCode":"if (first == null) throw new InvalidOperationException(\"first stream must be initialized before CombineLatest\");","typeGuard":"bool IsNonNull<T>(IObservable<T> s) => s is not null;","tryCatchPattern":"try { var combined = first.CombineLatest(second, third, /* ... */); } catch (ArgumentNullException ex) when (ex.ParamName == \"first\") { /* initialize primary stream or fall back */ }","preventionTips":["Resolve DI dependencies before composing pipelines so no stream is null","Coalesce optional streams at creation: stream ?? Observable.Empty<T>()","Keep stream variables initialized in constructors, not lazily on first use","Run nullable reference type analysis to flag uninitialized observable fields"],"tags":["csharp","rx","argument-validation","null-reference"],"backgroundTag":"null-argument","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}