{"record":{"id":"5bcca61ecd2d867d","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-tenth","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'tenth')","messagePattern":"Value cannot be null\\. \\(Parameter 'tenth'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1510,"sourceCode":"                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            if (tenth == null)\n                throw new ArgumentNullException(nameof(tenth));\n\n            return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);\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        /// <typeparam name=\"TEleventh\">The type of the elements in the eleventh source sequence.</typeparam>","sourceCodeStart":1492,"sourceCodeEnd":1528,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1492-L1528","documentation":"System.Reactive's public Observable.CombineLatest overload taking ten source sequences eagerly validates each argument and throws ArgumentNullException when any is null. Rx operators do not accept null sources; validation happens synchronously at call time before any subscription. Here the 'tenth' argument was null.","triggerScenarios":"Calling Observable.CombineLatest(first..tenth) where the tenth IObservable<T> argument is null, e.g. a variable that was never assigned, a dictionary/lookup miss returning null, or a factory method that returned null.","commonSituations":"Building CombineLatest chains from conditional sources (if/else that leaves a variable null), mock setups returning null, nullable fields not yet initialized, or deserialized configuration where a source was expected but absent.","solutions":["Assign a real observable to the tenth argument before calling CombineLatest.","If the source may be absent, substitute Observable.Empty<T>() (or a default sequence) instead of null.","Check the code path producing the tenth sequence (factory, cache, config) and fix why it returns null.","Wrap the call in ArgumentNullException handling only at top-level boundaries to surface a clear diagnostic."],"exampleFix":"// before\nIObservable<int> tenth = sources.TryGetValue(\"tenth\", out var s) ? s : null;\nvar z = Observable.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);\n// after\nIObservable<int> tenth = sources.TryGetValue(\"tenth\", out var s) ? s : Observable.Empty<int>();\nvar z = Observable.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);","handlingStrategy":"validation","validationCode":"if (tenth == null) throw new InvalidOperationException(\"CombineLatest: 'tenth' source is null — supply a real observable or Observable.Empty<int>()\");","typeGuard":"bool IsValidSource<T>(IObservable<T> s) => s is not null;","tryCatchPattern":"try { return Observable.CombineLatest(a,b,c,d,e,f,g,h,i,j); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"tenth\") { log.Error(\"tenth source was null\"); return Observable.Empty<(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10)>(); }","preventionTips":["Never assign null to IObservable fields; use Observable.Empty or Observable.Never as defaults","Use nullable reference types (IObservable<T>?) to make intent explicit","Return Empty/Throw from factories instead of null","Null-check all sources in composition helpers before delegating to Rx operators"],"tags":["csharp","rx","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"}