{"record":{"id":"c79036b337b14c5a","repo":"dotnet/reactive","slug":"resultselector-observable-multiple-zip","errorCode":null,"errorMessage":"resultSelector","messagePattern":"resultSelector","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":923,"sourceCode":"\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 (source14 == null)\n            {\n                throw new ArgumentNullException(nameof(source14));\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, source14, 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>\n        /// <typeparam name=\"TSource6\">The type of the elements in the sixth source sequence.</typeparam>\n        /// <typeparam name=\"TSource7\">The type of the elements in the seventh source sequence.</typeparam>\n        /// <typeparam name=\"TSource8\">The type of the elements in the eighth source sequence.</typeparam>\n        /// <typeparam name=\"TSource9\">The type of the elements in the ninth source sequence.</typeparam>\n        /// <typeparam name=\"TSource10\">The type of the elements in the tenth source sequence.</typeparam>","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L905-L941","documentation":"System.Reactive's 14-source Zip overload throws ArgumentNullException when the resultSelector delegate is null. The Zip operator eagerly validates all arguments before subscribing so failures surface synchronously at the call site rather than inside the observable pipeline. A null selector would make it impossible to combine the zipped elements.","triggerScenarios":"Calling Observable.Zip(source1..source14, resultSelector) where the 15th argument (Func<...,-,TResult>) is null, e.g. passing a variable that was never assigned or a method group that resolved to null.","commonSituations":"Storing the selector in a field/variable initialized later or conditionally; refactoring that removed a lambda but left the argument; reflection- or DI-composed pipelines supplying a null delegate.","solutions":["Pass a non-null result selector lambda or method group as the 15th argument","If the selector may be absent, guard with a default selector (e.g. (a1,...,a14) => default(TResult)) or use Tuple/ValueTuple creation instead","Trace the variable holding the selector upstream to find where it became null"],"exampleFix":"// before\nObservable.Zip(s1, s2, /* ... */ s14, null);\n// after\nObservable.Zip(s1, s2, /* ... */ s14, (v1, v2, /* ... */ v14) => Combine(v1, v2 /* ... */));","handlingStrategy":"validation","validationCode":"if (resultSelector is null) throw new ArgumentNullException(nameof(resultSelector));","typeGuard":"bool IsValidSelector<T1,...,T14,TResult>(Func<T1,...,T14,TResult>? f) => f is not null;","tryCatchPattern":"try\n{\n    var zipped = Observable.Zip(s1, ..., s14, resultSelector);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == nameof(resultSelector))\n{\n    // supply a fallback selector or log and abort composition\n}","preventionTips":["Never pass nullable Func variables directly to Zip; ensure assignment before composition","Prefer method groups or named lambdas over computed delegates that can be null","Enable nullable reference types so null delegate flow is caught at compile time"],"tags":["null-argument","rx","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-23T08:17:48.524Z"}