{"record":{"id":"56357e88fdde272c","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source9-56357e","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source9')","messagePattern":"Value cannot be null\\. \\(Parameter 'source9'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":413,"sourceCode":"\n            if (source6 == null)\n            {\n                throw new ArgumentNullException(nameof(source6));\n            }\n\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 (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, 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":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L395-L431","documentation":"The 9-source Zip overload checks source9 at Observable.Multiple.Zip.cs:413; a null ninth observable throws ArgumentNullException with Parameter 'source9'. Like the other guards, it fires synchronously at the Zip call, giving fail-fast diagnostics before the query ever runs.","triggerScenarios":"Passing null as the ninth (final sequence) IObservable argument of the 9-argument Observable.Zip, e.g. an unassigned field or null returned by a stream factory.","commonSituations":"Nine-source aggregations where the last feed is newly added and not wired in all environments; partial test stubs; feature-flagged streams disabled leaving a null in the final position.","solutions":["Pass a valid IObservable for source9; substitute Observable.Empty<TSource9>() when the source can legitimately be missing.","Repair the producing method so it returns an empty observable instead of null.","Add a null-check/normalization step for all sources before composing.","Reconsider arity: if sources are frequently optional, compose from a list of sources or use a different combinator that tolerates absence."],"exampleFix":"// before\nvar z = Observable.Zip(a, b, c, d, e, f, g, h, lastStream, sel); // lastStream == null\n// after\nvar z = Observable.Zip(a, b, c, d, e, f, g, h, lastStream ?? Observable.Empty<T9>(), sel);","handlingStrategy":"validation","validationCode":"if (source9 == null)\n    source9 = Observable.Empty<TSource9>();","typeGuard":"static bool Bound<T>(IObservable<T>? s) => s is not null;","tryCatchPattern":"try\n{\n    var z = Observable.Zip(source1, source2, source3, source4, source5, source6, source7, source8, source9, selector);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source9\")\n{\n    z = Observable.Empty<TResult>();\n}","preventionTips":["When adding a new source to a Zip chain, update every environment/wiring site at once.","Apply a uniform null-to-empty normalization to the whole source list before Zip.","Enable nullable reference types so the final IObservable argument can't be silently null.","Add a construction-time test per composition so Rx's eager guards run in CI."],"tags":["csharp","dotnet","rx","argument-null","zip"],"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"}