{"record":{"id":"c932c5fb39e0eee1","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source8-observable-multiple","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source8')","messagePattern":"Value cannot be null\\. \\(Parameter 'source8'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":339,"sourceCode":"\n            if (source5 == null)\n            {\n                throw new ArgumentNullException(nameof(source5));\n            }\n\n            if (source6 == null)\n            {\n                throw new ArgumentNullException(nameof(source6));\n            }\n\n            if (source7 == null)\n            {\n                throw new ArgumentNullException(nameof(source7));\n            }\n\n            if (source8 == null)\n            {\n                throw new ArgumentNullException(nameof(source8));\n            }\n\n            if (resultSelector == null)\n            {\n                throw new ArgumentNullException(nameof(resultSelector));\n            }\n\n            return s_impl.CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector);\n        }\n\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n        /// </summary>\n        /// <typeparam name=\"TSource1\">The type of the elements in the first source sequence.</typeparam>\n        /// <typeparam name=\"TSource2\">The type of the elements in the second source sequence.</typeparam>\n        /// <typeparam name=\"TSource3\">The type of the elements in the third source sequence.</typeparam>\n        /// <typeparam name=\"TSource4\">The type of the elements in the fourth source sequence.</typeparam>\n        /// <typeparam name=\"TSource5\">The type of the elements in the fifth source sequence.</typeparam>","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L321-L357","documentation":"The 8-source CombineLatest overload validates all eight sources plus resultSelector, throwing ArgumentNullException for the first null. Here source8 was null, so the guard at line 339 fired. Note the final overload is checked before resultSelector, so a null selector would be reported separately.","triggerScenarios":"Calling Observable.CombineLatest with null in the eighth source slot — e.g. the last stream of a fixed-width composition that was conditionally created.","commonSituations":"Last observable in a generated/pipeline-composed set not initialized; null returned by a wrapper method for the final stream; positional-argument mix-ups when adding the eighth source during refactoring.","solutions":["Provide a non-null eighth observable, using Observable.Empty<T8>() or Observable.Never<T8>() when absence is legitimate.","Add a null check on source8 at the call site.","Fix the code path that leaves source8 unassigned.","After adding/removing sources, recheck the full argument list against the parameter names."],"exampleFix":"// before\nvar combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, sel); // s8 == null\n// after\nvar combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8 ?? Observable.Never<T8>(), sel);","handlingStrategy":"validation","validationCode":"if (source8 == null) source8 = Observable.Never<TSource8>();\nif (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector));","typeGuard":"static bool Complete(IObservable<T8> s8, Func<...> sel) => s8 is not null && sel is not null;","tryCatchPattern":"try\n{\n    var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, sel);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source8\")\n{\n    // supply the missing eighth stream, then recompose\n}","preventionTips":["When adding sources to a composition, recheck every slot including the last","Never return null from wrapper methods that promise IObservable<T>","Default uninitialized streams to Observable.Never in constructors","Run nullable reference type analysis to catch unset observables"],"tags":["csharp","reactive-extensions","null-argument","argument-validation"],"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"}