{"record":{"id":"d84c553aa1ed0cc3","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-source5-d84c55","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'source5')","messagePattern":"Value cannot be null\\. \\(Parameter 'source5'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":135,"sourceCode":"\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 (source5 == null)\n            {\n                throw new ArgumentNullException(nameof(source5));\n            }\n\n            if (resultSelector == null)\n            {\n                throw new ArgumentNullException(nameof(resultSelector));\n            }\n\n            return s_impl.Zip(source1, source2, source3, source4, source5, 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":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L117-L153","documentation":"System.ArgumentNullException thrown by Observable.Zip's 5-source overload when the fifth source sequence (source5) is null. This is the last source checked before resultSelector in the 5-source Zip; the exception is raised eagerly at call time.","triggerScenarios":"Calling Observable.Zip(source1, source2, source3, source4, null, resultSelector) with a null fifth IObservable<T> argument.","commonSituations":"Five-way merges where the fifth stream is optional (e.g. an audit or metrics stream) and was not wired; nullable fields for peripheral streams; DI registrations missing for the fifth dependency.","solutions":["Ensure source5 is a valid IObservable<T>; substitute Observable.Empty<T5>() if the stream is optional.","Register/initialize the fifth stream's producer so it no longer returns null.","Coalesce at the call site: source5 ?? Observable.Empty<T5>()."],"exampleFix":"// before\nvar z = Observable.Zip(s1, s2, s3, s4, auditStream, sel); // auditStream not wired, null\n// after\nvar z2 = Observable.Zip(s1, s2, s3, s4, auditStream ?? Observable.Empty<AuditEvent>(), sel);","handlingStrategy":"validation","validationCode":"if (source5 is null) throw new InvalidOperationException(\"source5 stream was not initialized\");","typeGuard":"bool HasSource<T>(IObservable<T>? s) => s is not null;","tryCatchPattern":"try { var z = Observable.Zip(s1, s2, s3, s4, source5, sel); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source5\") { log.Error(\"Fifth stream was null\"); }","preventionTips":["Treat optional peripheral streams as Observable.Empty<T>() by default, null never.","Check DI/startup wiring for every stream referenced in large merges.","Use nullable reference type annotations to surface uninitialized stream fields."],"tags":["dotnet","rx","null-argument","argument-validation"],"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"}