{"record":{"id":"fca7db864a4f0a9b","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source4-fca7db","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source4')","messagePattern":"Value cannot be null\\. \\(Parameter 'source4'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":83,"sourceCode":"        {\n            if (source1 == null)\n            {\n                throw new ArgumentNullException(nameof(source1));\n            }\n\n            if (source2 == null)\n            {\n                throw new ArgumentNullException(nameof(source2));\n            }\n\n            if (source3 == null)\n            {\n                throw new ArgumentNullException(nameof(source3));\n            }\n\n            if (source4 == null)\n            {\n                throw new ArgumentNullException(nameof(source4));\n            }\n\n            if (resultSelector == null)\n            {\n                throw new ArgumentNullException(nameof(resultSelector));\n            }\n\n            return s_impl.Zip(source1, source2, source3, source4, 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":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L65-L101","documentation":"The four-source Observable.Zip overload throws ArgumentNullException when resultSelector is null. All four source sequences passed validation; the combining Func<TSource1,TSource2,TSource3,TSource4,TResult> is null. Provide a non-null selector that maps the four latest element tuples to the result.","triggerScenarios":"Calling Observable.Zip(source1, source2, source3, source4, resultSelector) with a null selector delegate.","commonSituations":"Selector retrieved from a strategy/registry lookup that returned null; passing a delegate field that was never assigned in a partially-constructed object.","solutions":["Pass a valid lambda or method group as the four-argument result selector.","Default the selector when it is dynamically resolved (selector ?? ((a,b,c,d) => default(TResult))).","Assert delegate fields are assigned before using them in zip construction."],"exampleFix":"// before\nObservable.Zip(a, b, c, d, combine); // combine == null\n// after\nFunc<int, int, int, int, int> combine = combineFn ?? ((w, x, y, z) => w + x + y + z);\nObservable.Zip(a, b, c, d, combine);","handlingStrategy":"validation","validationCode":"if (resultSelector == null) throw new InvalidOperationException(\"resultSelector must be provided\");","typeGuard":"bool IsValid<T1,T2,T3,T4,TResult>(Func<T1,T2,T3,T4,TResult> f) => f is not null;","tryCatchPattern":"try { return Observable.Zip(a, b, c, d, resultSelector); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"resultSelector\") { /* assign default selector and retry */ }","preventionTips":["Inline lambda selectors avoid null delegate indirection entirely","Coalesce registry/strategy lookups to a default selector","Ensure objects are fully constructed (selectors assigned) before pipelines use them"],"tags":["null-argument","reactive-extensions","zip","delegate"],"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"}