{"record":{"id":"a54f5530b90bd3e1","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source5","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source5')","messagePattern":"Value cannot be null\\. \\(Parameter 'source5'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"AsyncRx.NET/System.Reactive.Async/Linq/Operators/Zip.Generated.cs","lineNumber":502,"sourceCode":"\n                await Task.WhenAll(sub1, sub2, sub3, sub4, sub5, sub6, sub7).ConfigureAwait(false);\n\n                return d;\n            });\n        }\n\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();","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/AsyncRx.NET/System.Reactive.Async/Linq/Operators/Zip.Generated.cs#L484-L520","documentation":"The same 7-source Zip overload validates its arguments in order and throws ArgumentNullException when the 5th source observable is null. Zip needs every participating sequence, so a null in any slot aborts operator construction before subscription.","triggerScenarios":"Calling AsyncObservable.Zip(source1, source2, source3, source4, null, source6, source7) with a null fifth IAsyncObservable argument.","commonSituations":"The fifth stream comes from a nullable return value (e.g. a cache miss returning null instead of an empty observable); list/dictionary-driven wiring where one entry is missing; copy-pasted zip calls after a source was renamed and left uninitialized.","solutions":["Supply a non-null IAsyncObservable for source5, or use AsyncObservable.Empty<T5>() when it can legitimately be absent.","Add an up-front null check or require-non-null helper for each source before invoking Zip.","Refactor to a lower-arity Zip overload or a Merge-based composition if one input is truly optional."],"exampleFix":"// before\nvar zipped = AsyncObservable.Zip(a, b, c, d, fifthOrNull, f, g);\n// after\nif (fifthOrNull == null) throw new InvalidOperationException(\"fifth source missing\");\nvar zipped = AsyncObservable.Zip(a, b, c, d, fifthOrNull, f, g);","handlingStrategy":"validation","validationCode":"var sources = new[] { s1, s2, s3, s4, s5, s6, s7 };\nif (sources.Any(s => s == null)) throw new InvalidOperationException(\"all seven zip sources must be non-null\");","typeGuard":"bool IsValidZipInput<T>(IAsyncObservable<T> s) => s is not null;","tryCatchPattern":"try\n{\n    var zipped = AsyncObservable.Zip(s1, s2, s3, s4, s5, s6, s7);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source5\")\n{\n    logger.LogError(ex, \"5th zip source was null\");\n}","preventionTips":["Never let stream-producing factories return null; return AsyncObservable.Empty<T>() on miss","Check nullable annotations on every feed before composing","Write unit tests covering each source slot of multi-way zips"],"tags":["argument-null","zip","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"}