{"record":{"id":"6ab11edb723a8759","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-fourth","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'fourth')","messagePattern":"Value cannot be null\\. \\(Parameter 'fourth'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1449,"sourceCode":"        /// <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\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>","sourceCodeStart":1431,"sourceCodeEnd":1467,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1431-L1467","documentation":"The nine-source tuple CombineLatest overload throws ArgumentNullException for parameter 'fourth' when the fourth observable source is null. Arguments are validated in declaration order at composition time, so this error means the first three sources were fine and the fourth slot received null. This is part of Rx's documented contract that all source parameters are non-null.","triggerScenarios":"Calling the 9-argument Observable.CombineLatest with null in the fourth positional argument (IObservable<TFourth>).","commonSituations":"Dashboard-style UIs combining many view streams where one fragment failed to initialize; plugin systems where an optional module contributed a null stream; manual argument expansion from a list that was shorter than expected.","solutions":["Pass a non-null IObservable<TFourth> in the fourth position","Replace with Observable.Empty<TFourth>() or Observable.Never<TFourth>() if the stream is optional","Repair the initializer/registry responsible for the fourth stream","Build the sources into an array, filter nulls, and use the params CombineLatest overload"],"exampleFix":"// before\nvar combined = first.CombineLatest(second, third, fourth, ...); // fourth == null\n// after\nvar combined = first.CombineLatest(second, third, fourth ?? Observable.Empty<TFourth>(), ...);","handlingStrategy":"validation","validationCode":"if (fourth == null) throw new InvalidOperationException(\"fourth 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, fourth, /* ... */); } catch (ArgumentNullException ex) when (ex.ParamName == \"fourth\") { /* supply default stream */ }","preventionTips":["When expanding a list into positional arguments, assert the list length matches the overload arity","Use the params/array overload for variable stream counts","Initialize plugin-contributed streams with Observable.Never<T>() placeholders","Turn on nullable reference type warnings"],"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"}