{"record":{"id":"b2bb6a5ee7716057","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-twelfth","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'twelfth')","messagePattern":"Value cannot be null\\. \\(Parameter 'twelfth'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":1624,"sourceCode":"                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            if (eleventh == null)\n                throw new ArgumentNullException(nameof(eleventh));\n            if (twelfth == null)\n                throw new ArgumentNullException(nameof(twelfth));\n\n            return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth);\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":1606,"sourceCodeEnd":1642,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L1606-L1642","documentation":"In the 12-source CombineLatest overload, System.Reactive throws ArgumentNullException when the twelfth (last) observable sequence is null. All arguments are null-checked before s_impl.CombineLatest is invoked, so the throw is synchronous and occurs before any subscription. The parameter name in the message identifies the null argument.","triggerScenarios":"Calling Observable.CombineLatest(first..twelfth) with null as the twelfth (Twelfth) IObservable<T> argument, e.g. omitting the last source when copying an example or passing a nullable stream variable that was never assigned.","commonSituations":"Copy-paste edits of long argument lists dropping the final argument; optional last stream (e.g. telemetry) that is null in some environments; deserialized configuration where the 12th stream binding is missing.","solutions":["Provide a valid IObservable<T> as the twelfth argument; fall back to Observable.Empty<T>() if it is intentionally absent.","Check the assignment/lookup that produces the twelfth sequence and fix the null path.","Migrate to the collection overload CombineLatest(sources, resultSelector) and validate the list length/nulls once.","Apply a null-coalescing default at the call site."],"exampleFix":"// before\nvar combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, null); // twelfth null\n// after\nvar twelfth = GetTwelfth() ?? Observable.Empty<int>();\nvar combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, twelfth);","handlingStrategy":"validation","validationCode":"if (twelfth is null) throw new InvalidOperationException(\"twelfth source must be provided\");\ntwelfth ??= Observable.Empty<TTwelfth>();","typeGuard":"static bool IsNotNull<T>(IObservable<T>? s) => s is not null;","tryCatchPattern":"try\n{\n    var combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"twelfth\")\n{\n    logger.LogWarning(\"twelfth source was null\");\n    throw;\n}","preventionTips":["Verify argument count after copy-pasting long CombineLatest calls","Use named arguments (twelfth:) to make dropped arguments visible","Never let optional streams default to null; default to Observable.Empty<T>()","Prefer collection-based overloads when arity grows past a handful of sources"],"tags":["null-argument","reactive-extensions","argument-validation","combinelatest"],"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"}