{"record":{"id":"b875d1abeb89c979","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-second-observable-multiple","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'second')","messagePattern":"Value cannot be null\\. \\(Parameter 'second'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1445,"sourceCode":"        /// <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);\n        }\n","sourceCodeStart":1427,"sourceCodeEnd":1463,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1427-L1463","documentation":"The nine-source tuple CombineLatest overload throws ArgumentNullException for parameter 'second' when the second observable source is null. Like all Rx public operators, it validates arguments eagerly at composition time so that broken pipelines are reported at the exact call site. The doc comment guarantees that none of first..ninth may be null.","triggerScenarios":"Calling the 9-argument CombineLatest with a null IObservable<TSecond> in the second position.","commonSituations":"A secondary stream (e.g. a settings or polling stream) that failed to initialize; event aggregators returning null for unsubscribed channels; copy-pasted combine chains where one argument was left as null during editing.","solutions":["Supply a non-null IObservable<TSecond> for the second argument","Fall back to Observable.Empty<TSecond>() or Observable.Never<TSecond>() for optional streams","Trace and fix the null-producing initializer of the second stream","Assert non-nullness of all streams at pipeline construction in debug builds"],"exampleFix":"// before\nvar combined = first.CombineLatest(second, third, ...); // second == null\n// after\nvar combined = first.CombineLatest(second ?? Observable.Empty<TSecond>(), third, ...);","handlingStrategy":"validation","validationCode":"if (second == null) throw new InvalidOperationException(\"second 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 == \"second\") { /* substitute default stream */ }","preventionTips":["Initialize secondary streams (settings, polling) eagerly in startup code","Return Observable.Never<T>() rather than null for not-yet-active streams","Avoid copy-paste editing of long CombineLatest argument lists; use named locals","Enable nullable reference types for compile-time detection"],"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"}