{"record":{"id":"4bf19c4649f38860","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-third","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'third')","messagePattern":"Value cannot be null\\. \\(Parameter 'third'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1447,"sourceCode":"        /// <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\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence of tuple values whenever any of the observable sequences produces an element.","sourceCodeStart":1429,"sourceCodeEnd":1465,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1429-L1465","documentation":"The tuple-based nine-source CombineLatest overload validates its arguments sequentially and throws ArgumentNullException with parameter name 'third' when the third observable is null. This fail-fast check exists so composition errors surface at the call site instead of causing NullReferenceException inside the operator later. It is a documented precondition of the method.","triggerScenarios":"Passing null as the third IObservable<TThird> to the 9-argument CombineLatest overload.","commonSituations":"Combining three-plus sensor or UI streams where one service dependency was null; unit-test scaffolding that left a stub stream uninitialized; refactors that renamed a local but left a stale null field in place.","solutions":["Provide a valid IObservable<TThird> instance for the third argument","Use Observable.Empty<TThird>() or Observable.Never<TThird>() when the stream may legitimately be absent","Fix the component responsible for creating the third stream","Group sources into an array and use the array overload plus a filter for nulls before combining"],"exampleFix":"// before\nvar combined = first.CombineLatest(second, third, ...); // third == null\n// after\nvar combined = first.CombineLatest(second, third ?? Observable.Empty<TThird>(), ...);","handlingStrategy":"validation","validationCode":"if (third == null) throw new InvalidOperationException(\"third 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 == \"third\") { /* fix or default the third stream */ }","preventionTips":["Guard every stream-producing service against null returns at its boundary","Rename stale fields after refactors so leftover nulls are visible","Build source lists in a collection and validate before combining","Adopt nullable reference types to surface uninitialized streams early"],"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"}