{"record":{"id":"c3bec7e49a50d107","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source11-observable-multiple","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source11')","messagePattern":"Value cannot be null\\. \\(Parameter 'source11'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs","lineNumber":603,"sourceCode":"\n            if (source8 == null)\n            {\n                throw new ArgumentNullException(nameof(source8));\n            }\n\n            if (source9 == null)\n            {\n                throw new ArgumentNullException(nameof(source9));\n            }\n\n            if (source10 == null)\n            {\n                throw new ArgumentNullException(nameof(source10));\n            }\n\n            if (source11 == null)\n            {\n                throw new ArgumentNullException(nameof(source11));\n            }\n\n            if (resultSelector == null)\n            {\n                throw new ArgumentNullException(nameof(resultSelector));\n            }\n\n            return s_impl.CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector);\n        }\n\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n        /// </summary>\n        /// <typeparam name=\"TSource1\">The type of the elements in the first source sequence.</typeparam>\n        /// <typeparam name=\"TSource2\">The type of the elements in the second source sequence.</typeparam>\n        /// <typeparam name=\"TSource3\">The type of the elements in the third source sequence.</typeparam>\n        /// <typeparam name=\"TSource4\">The type of the elements in the fourth source sequence.</typeparam>\n        /// <typeparam name=\"TSource5\">The type of the elements in the fifth source sequence.</typeparam>","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.CombineLatest.cs#L585-L621","documentation":"The public CombineLatest overload for 11 sources throws ArgumentNullException when the source11 argument is null. Rx.NET validates all source sequences and the result selector eagerly before subscribing, because a null source would otherwise fail only later with an obscure NullReferenceException inside the query pipeline.","triggerScenarios":"Calling Observable.CombineLatest(s1..s11, resultSelector) with a null 11th argument — e.g. a variable holding an IObservable that was never assigned, a dictionary lookup that returned null, or a conditional source that defaulted to null.","commonSituations":"Building a chain of observables from optional dependencies or config-driven sources where the last source is conditionally created; passing the result of a factory method that returns null instead of Observable.Empty.","solutions":["Ensure the argument passed as source11 is a non-null IObservable before calling CombineLatest","If the source may be absent, substitute Observable.Empty<TSource11>() (noting CombineLatest then produces no output until all sources emit) or Observable.Return(defaultValue)","Check where the null originates (uninitialized field, failed lookup) and fix the producer","Wrap the call in ArgumentNullException handling only at the boundary where you cannot guarantee inputs"],"exampleFix":"// before\nObservable.CombineLatest(a, b, c, d, e, f, g, h, i, j, maybeEleventh, (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) => Combine(x11));\n// after\nvar s11 = maybeEleventh ?? Observable.Empty<T11>();\nObservable.CombineLatest(a, b, c, d, e, f, g, h, i, j, s11, (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) => Combine(x11));","handlingStrategy":"validation","validationCode":"if (source11 is null) throw new ArgumentNullException(nameof(source11));\n// or coalesce:\n// source11 ??= Observable.Empty<T11>();","typeGuard":"static bool IsNotNullSource<T>(IObservable<T> s) => s is not null;","tryCatchPattern":"try\n{\n    combined = Observable.CombineLatest(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, selector);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source11\")\n{\n    // log and substitute a fallback observable or rethrow with context\n}","preventionTips":["Never let factory/lookup methods return null observables; return Observable.Empty instead","Coalesce optional sources with ?? Observable.Empty<T>() at construction","Use nullable reference types (IObservable<T>?) and compiler flow analysis to catch unassigned sources","Validate the full source array before calling high-arity overloads"],"tags":["null-argument","argument-validation","reactive-extensions"],"backgroundTag":"null-argument","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}