{"record":{"id":"db55dc58b6e1d8b8","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-selector-zip-generated","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'selector')","messagePattern":"Value cannot be null\\. \\(Parameter 'selector'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"AsyncRx.NET/System.Reactive.Async/Linq/Operators/Zip.Generated.cs","lineNumber":508,"sourceCode":"\n        public static IAsyncObservable<TResult> Zip<T1, T2, T3, T4, T5, T6, T7, TResult>(this IAsyncObservable<T1> source1, IAsyncObservable<T2> source2, IAsyncObservable<T3> source3, IAsyncObservable<T4> source4, IAsyncObservable<T5> source5, IAsyncObservable<T6> source6, IAsyncObservable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> selector)\n        {\n            if (source1 == null)\n                throw new ArgumentNullException(nameof(source1));\n            if (source2 == null)\n                throw new ArgumentNullException(nameof(source2));\n            if (source3 == null)\n                throw new ArgumentNullException(nameof(source3));\n            if (source4 == null)\n                throw new ArgumentNullException(nameof(source4));\n            if (source5 == null)\n                throw new ArgumentNullException(nameof(source5));\n            if (source6 == null)\n                throw new ArgumentNullException(nameof(source6));\n            if (source7 == null)\n                throw new ArgumentNullException(nameof(source7));\n            if (selector == null)\n                throw new ArgumentNullException(nameof(selector));\n\n            return Create<TResult>(async observer =>\n            {\n                var d = new CompositeAsyncDisposable();\n\n                var (observer1, observer2, observer3, observer4, observer5, observer6, observer7) = AsyncObserver.Zip(observer, selector);\n\n                var sub1 = source1.SubscribeSafeAsync(observer1).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n                var sub2 = source2.SubscribeSafeAsync(observer2).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n                var sub3 = source3.SubscribeSafeAsync(observer3).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n                var sub4 = source4.SubscribeSafeAsync(observer4).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n                var sub5 = source5.SubscribeSafeAsync(observer5).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n                var sub6 = source6.SubscribeSafeAsync(observer6).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n                var sub7 = source7.SubscribeSafeAsync(observer7).AsTask().ContinueWith(disposable => d.AddAsync(disposable.Result).AsTask()).Unwrap();\n\n                await Task.WhenAll(sub1, sub2, sub3, sub4, sub5, sub6, sub7).ConfigureAwait(false);\n\n                return d;","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/AsyncRx.NET/System.Reactive.Async/Linq/Operators/Zip.Generated.cs#L490-L526","documentation":"The 7-source Zip overload with a result selector Func<T1..T7, ValueTask<TResult>> throws ArgumentNullException('selector') when the selector delegate is null. After checking all seven sources, the operator requires a non-null function to combine the zipped elements (it is invoked by AsyncObserver.Zip to project each tuple).","triggerScenarios":"Calling AsyncObservable.Zip(s1..s7, (Func<T1,...,T7,ValueTask<TResult>>)null) - passing null where the async result-selector lambda should be.","commonSituations":"A selector stored in a variable or returned from a factory was null; conditional lambda assignment skipped; refactoring from the no-selector overload to the selector overload left the argument empty.","solutions":["Supply a valid async selector, e.g. (t1, t2, t3, t4, t5, t6, t7) => ValueTask.FromResult(t1 + t7).","If no projection is needed, use the plain 7-source Zip overload that returns a tuple instead of passing null.","Guard the selector variable for null before calling Zip."],"exampleFix":"// before\nFunc<T1,T2,T3,T4,T5,T6,T7,ValueTask<TResult>> selector = maybeSelector;\nvar zipped = AsyncObservable.Zip(s1, s2, s3, s4, s5, s6, s7, selector);\n// after\nvar zipped = AsyncObservable.Zip(s1, s2, s3, s4, s5, s6, s7,\n    maybeSelector ?? ((t1, t2, t3, t4, t5, t6, t7) => ValueTask.FromResult(project(t1, t2, t3, t4, t5, t6, t7))));","handlingStrategy":"validation","validationCode":"if (selector == null) throw new InvalidOperationException(\"zip result selector must be provided\");","typeGuard":"bool IsValidSelector<T1,T2,T3,T4,T5,T6,T7,TResult>(Func<T1,T2,T3,T4,T5,T6,T7,ValueTask<TResult>> f) => f is not null;","tryCatchPattern":"try\n{\n    var zipped = AsyncObservable.Zip(s1, s2, s3, s4, s5, s6, s7, selector);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"selector\")\n{\n    logger.LogError(ex, \"zip selector was null\");\n}","preventionTips":["Pass selector lambdas inline rather than through nullable variables","Use the tuple-returning Zip overload when no projection is needed","Initialize Func fields at declaration or make them required constructor parameters"],"tags":["argument-null","zip","selector","async-rx"],"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"}