{"record":{"id":"c4e36273931b17d1","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source3-c4e362","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source3')","messagePattern":"Value cannot be null\\. \\(Parameter 'source3'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":38,"sourceCode":"        /// <param name=\"source3\">Third observable source.</param>\n        /// <param name=\"resultSelector\">Function to invoke for each series of elements at corresponding indexes in the sources.</param>\n        /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source1\"/> or <paramref name=\"source2\"/> or <paramref name=\"source3\"/> or <paramref name=\"resultSelector\"/> is null.</exception>\n        public static IObservable<TResult> Zip<TSource1, TSource2, TSource3, TResult>(this IObservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Func<TSource1, TSource2, TSource3, TResult> resultSelector)\n        {\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 (resultSelector == null)\n            {\n                throw new ArgumentNullException(nameof(resultSelector));\n            }\n\n            return s_impl.Zip(source1, source2, source3, 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=\"TResult\">The type of the elements in the result sequence, returned by the selector function.</typeparam>","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L20-L56","documentation":"The Observable.Zip three-source overload throws ArgumentNullException when resultSelector is null. All source sequences were non-null; the combining function itself is the missing argument. Rx requires an explicit selector because it defines the output type and combination logic. Provide a non-null Func<TSource1,TSource2,TSource3,TResult>.","triggerScenarios":"Calling Observable.Zip(source1, source2, source3, resultSelector) with a null selector delegate.","commonSituations":"Storing the selector in a variable resolved from config/DI that was never assigned; passing a method group from a class whose method is null via a delegate field; generic helper code forwarding a null selector parameter.","solutions":["Pass a valid lambda or method group as the result selector.","If the selector is resolved dynamically, default it (e.g. selector ?? ((a,b,c) => default(TResult))).","Check intermediate delegate fields/parameters for null before forwarding them to Zip."],"exampleFix":"// before\nObservable.Zip(a, b, c, mySelector); // mySelector is null\n// after\nvar selector = mySelector ?? ((int x, int y, int z) => x + y + z);\nObservable.Zip(a, b, c, selector);","handlingStrategy":"validation","validationCode":"if (resultSelector == null) throw new InvalidOperationException(\"resultSelector must be provided\");","typeGuard":"bool IsValid<T1,T2,T3,TResult>(Func<T1,T2,T3,TResult> f) => f is not null;","tryCatchPattern":"try { return Observable.Zip(a, b, c, resultSelector); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"resultSelector\") { /* supply default selector */ }","preventionTips":["Never store selectors in fields that can be null; initialize them inline","When resolving delegates from DI/config, always coalesce to a default","Mark selector parameters as required in helper wrappers"],"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"}