{"record":{"id":"b94abde3860a3093","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source13-b94abd","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source13')","messagePattern":"Value cannot be null\\. \\(Parameter 'source13'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":803,"sourceCode":"\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 (source12 == null)\n            {\n                throw new ArgumentNullException(nameof(source12));\n            }\n\n            if (source13 == null)\n            {\n                throw new ArgumentNullException(nameof(source13));\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, source11, source12, source13, 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":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L785-L821","documentation":"This ArgumentNullException is thrown by the 13-source Observable.Zip overload when the 13th (last) observable source (source13) is null. Rx validates all sources and the resultSelector synchronously before building the query, reporting the exact null parameter name so the bad argument is easy to locate.","triggerScenarios":"Calling Observable.Zip(source1, ..., source12, null, resultSelector) with a null IObservable<TSource13> in the 13th positional slot (immediately before the resultSelector).","commonSituations":"The last stream in a long positional list was dropped or misordered during a refactor, shifting null into the source13 slot; an optional source was passed without a default; a builder that skipped the final channel.","solutions":["Trace the 13th argument and ensure its producer returns a non-null IObservable<TSource13>.","Substitute Observable.Empty<TSource13>() (Zip completes) or Observable.Never<TSource13>() (Zip waits) when the source is optional.","Guard the call with ArgumentNullException.ThrowIfNull(source13) before invoking Zip.","For long source lists, build and validate a List<IObservable<T>> and use the IEnumerable-based Zip overload to avoid positional mistakes."],"exampleFix":"// before\nvar zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, lastStream, (a, b, c, d, e, f, g, h, i, j, k, l, m) => a + m);\n\n// after\nvar s13 = lastStream ?? Observable.Empty<int>();\nvar zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, (a, b, c, d, e, f, g, h, i, j, k, l, m) => a + m);","handlingStrategy":"validation","validationCode":"if (source13 is null) throw new ArgumentNullException(nameof(source13));","typeGuard":"bool HasSource13<T>(IObservable<T>? s) => s is not null;","tryCatchPattern":"try\n{\n    var zipped = Observable.Zip(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, result);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == nameof(s13))\n{\n    logger.LogError(ex, \"Zip source13 was null\");\n}","preventionTips":["Review argument counts after refactors that add/remove Zip sources; use named arguments to avoid slot shifts.","Default optional sources to Observable.Empty<T>() at the point of acquisition.","Consider the IEnumerable-based Zip overload for 10+ sources to avoid positional errors.","Keep a startup invariant check that all required streams are non-null before composing queries."],"tags":["rx","null-argument","argument-validation","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"}