{"record":{"id":"481c5c031ff28b1b","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source1","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source1')","messagePattern":"Value cannot be null\\. \\(Parameter 'source1'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"AsyncRx.NET/System.Reactive.Async/Linq/Operators/Zip.Generated.cs","lineNumber":533,"sourceCode":"\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;\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, ValueTask<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();","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/AsyncRx.NET/System.Reactive.Async/Linq/Operators/Zip.Generated.cs#L515-L551","documentation":"A second 7-source Zip overload (with an async selector of type Func<T1..T7, ValueTask<TResult>>) validates source1 first and throws ArgumentNullException('source1') when the first observable is null. This is eager fail-fast validation before any operator state is created.","triggerScenarios":"Calling AsyncObservable.Zip(null, source2, source3, source4, source5, source6, source7, selector) with a null first IAsyncObservable argument.","commonSituations":"The primary/head stream comes from a method that returned null on an error path; a chained call like GetHead()?.Zip(...) was flattened and the null propagated; generic helper methods receiving a null 'main' observable.","solutions":["Ensure the first argument is a constructed IAsyncObservable; check its origin for null-returning paths.","Substitute AsyncObservable.Empty<T1>() when absence is a legitimate case.","Add a null guard or Debug.Assert at the call boundary."],"exampleFix":"// before\nvar out = AsyncObservable.Zip(head, s2, s3, s4, s5, s6, s7, selector);\n// after\nif (head == null) throw new InvalidOperationException(\"head source missing\");\nvar out = AsyncObservable.Zip(head, s2, s3, s4, s5, s6, s7, selector);","handlingStrategy":"validation","validationCode":"if (source1 == null) throw new InvalidOperationException(\"primary zip source 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, selector);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source1\")\n{\n    logger.LogError(ex, \"primary zip source was null\");\n}","preventionTips":["Check head-stream producers for null-returning error paths","Keep ?._ chaining or explicit null checks when sourcing the primary stream","Fail early with a domain message instead of letting ArgumentNullException surface"],"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"}