{"record":{"id":"ecb763c259e2251a","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-ninth","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'ninth')","messagePattern":"Value cannot be null\\. \\(Parameter 'ninth'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1459,"sourceCode":"        {\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\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence of tuple values whenever any of the observable sequences produces an element.\n        /// </summary>\n        /// <typeparam name=\"TFirst\">The type of the elements in the first source sequence.</typeparam>\n        /// <typeparam name=\"TSecond\">The type of the elements in the second source sequence.</typeparam>\n        /// <typeparam name=\"TThird\">The type of the elements in the third source sequence.</typeparam>\n        /// <typeparam name=\"TFourth\">The type of the elements in the fourth source sequence.</typeparam>\n        /// <typeparam name=\"TFifth\">The type of the elements in the fifth source sequence.</typeparam>\n        /// <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        /// <typeparam name=\"TTenth\">The type of the elements in the tenth source sequence.</typeparam>\n        /// <param name=\"first\">First observable source.</param>","sourceCodeStart":1441,"sourceCodeEnd":1477,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1441-L1477","documentation":"System.Reactive's public CombineLatest overload taking nine observable sequences validates every argument before delegating to the internal implementation. When the ninth observable source is null it throws ArgumentNullException with Parameter 'ninth'. This fail-fast guard exists so a bad composition fails immediately at the call site rather than later, deep inside subscription plumbing.","triggerScenarios":"Calling Observable.CombineLatest with nine IObservable<T> arguments (or via query syntax chains that map to it) where the ninth argument evaluates to null, e.g. a variable that was never assigned, a method returning null, or a dictionary/array lookup that missed.","commonSituations":"Building a sequence array/list at runtime and passing an element that ended up null; refactoring from fewer to more sources and leaving a placeholder null; a factory method returning null instead of Observable.Empty on some code path.","solutions":["Ensure the ninth argument is a non-null IObservable<T>; if it may be absent, substitute Observable.Empty<T>() or a default source","Inspect the expression producing the ninth sequence and fix whatever returns null (missing assignment, failed lookup)","Wrap the composition call in a null check or ArgumentNullException-guard of your own to fail with a clearer message","If sources come from a collection, use the IEnumerable-based CombineLatest overload after filtering out nulls"],"exampleFix":"// before\nIObservable<int> ninth = sources.Length > 8 ? sources[8] : null; // NRE/ArgumentNullException\nvar combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, ninth);\n// after\nIObservable<int> ninth = sources.Length > 8 ? sources[8] : Observable.Empty<int>();\nvar combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, ninth);","handlingStrategy":"validation","validationCode":"if (ninth == null) throw new ArgumentNullException(nameof(ninth)); // or: ninth ??= Observable.Empty<TNinth>();","typeGuard":"static bool IsNonNullSource<T>(IObservable<T> s) => s is not null;","tryCatchPattern":"try { return Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, ninth); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"ninth\") { /* log and use a default composition */ }","preventionTips":["Substitute Observable.Empty<T>() instead of null for absent sources","Null-check all source sequences at your API boundary before composing","Avoid null placeholders in long argument lists; build sequences via a collection and validate elements"],"tags":["rx","null-check","combinelatest","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"}