{"record":{"id":"07a0652c64d3ed3e","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source10-07a065","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source10')","messagePattern":"Value cannot be null\\. \\(Parameter 'source10'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":500,"sourceCode":"\n            if (source7 == null)\n            {\n                throw new ArgumentNullException(nameof(source7));\n            }\n\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 (resultSelector == null)\n            {\n                throw new ArgumentNullException(nameof(resultSelector));\n            }\n\n            return s_impl.Zip(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector);\n        }\n\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\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":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L482-L518","documentation":"System.Reactive's 10-argument Zip overload validates every argument eagerly when the public Zip method is called. Passing a null IObservable for the tenth source sequence causes an ArgumentNullException with Parameter 'source10' to be thrown immediately, before any subscription occurs. This fail-fast contract ensures invalid usage is caught at the call site rather than deep inside a subscription pipeline.","triggerScenarios":"Calling Observable.Zip(source1..source9, source10, resultSelector) (the 10-source overload in Observable.Multiple.Zip.cs) where the tenth IObservable<TSource10> argument is null.","commonSituations":"Chaining Zip calls where an earlier operator returned null; holding sequences in nullable fields/properties that were never initialized; wiring up sources from a dictionary or service locator where the tenth entry is missing.","solutions":["Ensure the tenth argument passed to Zip is a non-null IObservable; initialize it before the Zip call.","If the source may legitimately be absent, substitute Observable.Empty<TSource10>() or a default sequence instead of null.","Check where the tenth sequence is produced (a prior Rx operator or factory) and fix whatever returns null - Rx operators themselves never return null.","Wrap configuration/resolution of the sources in null checks before composing the query."],"exampleFix":"// before\nIObservable<int> source10 = condition ? obsA : null;\nvar zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, source10, (a,b,c,d,e,f,g,h,i,j) => a);\n// after\nIObservable<int> source10 = condition ? obsA : Observable.Empty<int>();\nvar zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, source10, (a,b,c,d,e,f,g,h,i,j) => a);","handlingStrategy":"validation","validationCode":"if (source1 == null) throw new InvalidOperationException(\"source1 must be provided\"); // ...repeat for sources 2-9\nif (source10 == null)\n{\n    source10 = Observable.Empty<TSource10>(); // or fix initialization\n}","typeGuard":"bool IsValidSource<T>(IObservable<T> s) => s is not null;\n// usage: if (sources.All(IsValidSource)) { /* call Zip */ }","tryCatchPattern":"try\n{\n    var zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, selector);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source10\")\n{\n    // log which argument was null and repair initialization\n}","preventionTips":["Never assign null to an IObservable field; prefer Observable.Empty<T>() as the empty default.","Validate the whole sources collection before composing: sources.All(s => s != null).","Avoid operator results being nullable - Rx operators always return non-null, so a null sequence indicates external code."],"tags":["csharp","dotnet","rxjs","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"}