{"record":{"id":"a08066b0835da8d8","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-fifth-observable-multiple-zip","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'fifth')","messagePattern":"Value cannot be null\\. \\(Parameter 'fifth'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":1281,"sourceCode":"        /// <param name=\"first\">First observable source.</param>\n        /// <param name=\"second\">Second observable source.</param>\n        /// <param name=\"third\">Third observable source.</param>\n        /// <param name=\"fourth\">Fourth observable source.</param>\n        /// <param name=\"fifth\">Fifth observable source.</param>\n        /// <returns>An observable sequence containing the result of combining elements of the sources using tuple values.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"first\"/> or <paramref name=\"second\"/> or <paramref name=\"third\"/> or <paramref name=\"fourth\"/> or <paramref name=\"fifth\"/> is null.</exception>\n        public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth)> Zip<TFirst, TSecond, TThird, TFourth, TFifth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth)\n        {\n            if (first == null)\n                throw new ArgumentNullException(nameof(first));\n            if (second == null)\n                throw new ArgumentNullException(nameof(second));\n            if (third == null)\n                throw new ArgumentNullException(nameof(third));\n            if (fourth == null)\n                throw new ArgumentNullException(nameof(fourth));\n            if (fifth == null)\n                throw new ArgumentNullException(nameof(fifth));\n\n            return s_impl.Zip(first, second, third, fourth, fifth);\n        }\n\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence of tuple values whenever all of the observable sequences have produced an element at a corresponding index.\n        /// </summary>\n        /// <typeparam name=\"TFirst\">The type of the elements in the first source sequence.</typeparam>\n        /// <typeparam name=\"TSecond\">The type of the elements in the second source sequence.</typeparam>\n        /// <typeparam name=\"TThird\">The type of the elements in the third source sequence.</typeparam>\n        /// <typeparam name=\"TFourth\">The type of the elements in the fourth source sequence.</typeparam>\n        /// <typeparam name=\"TFifth\">The type of the elements in the fifth source sequence.</typeparam>\n        /// <typeparam name=\"TSixth\">The type of the elements in the sixth source sequence.</typeparam>\n        /// <param name=\"first\">First observable source.</param>\n        /// <param name=\"second\">Second observable source.</param>\n        /// <param name=\"third\">Third observable source.</param>\n        /// <param name=\"fourth\">Fourth observable source.</param>\n        /// <param name=\"fifth\">Fifth observable source.</param>","sourceCodeStart":1263,"sourceCodeEnd":1299,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L1263-L1299","documentation":"The five-source Zip overload validates all arguments and throws ArgumentNullException when the 'fifth' observable sequence is null. Rx fails fast at composition time so the bad call is caught immediately rather than during subscription. The fifth source was null at the call site.","triggerScenarios":"Calling Observable.Zip(first, second, third, fourth, fifth) with fifth == null, e.g. the last source came from an optional API whose null result was forwarded directly.","commonSituations":"Optional last-stage streams (telemetry, audit) that return null when disabled, migration from older code where null meant 'no source', or misordered arguments shifting nulls into the fifth slot.","solutions":["Replace the null fifth argument with Observable.Empty<TFifth>() or a real source","Guard the call: if (fifth == null) handle/throw with context before composing","Fix the factory producing the fifth stream to never return null"],"exampleFix":"// before\nvar zipped = Observable.Zip(a, b, c, d, e); // e == null\n// after\nvar zipped = Observable.Zip(a, b, c, d, e ?? Observable.Empty<TFifth>());","handlingStrategy":"validation","validationCode":"var sources = new[] { first, second, third, fourth, fifth };\nif (sources.Any(s => s == null)) throw new ArgumentNullException(nameof(fifth), \"All Zip sources must be non-null\");","typeGuard":"bool Ready(IObservable<object>? s) => s is not null;","tryCatchPattern":"try { var zipped = Observable.Zip(a, b, c, d, e); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"fifth\") { /* default the fifth source or abort composition */ }","preventionTips":["Substitute Observable.Empty for disabled/optional streams instead of null","Guard optional source producers with contracts (Debug.Assert / ThrowIfNull)","Review nullable warnings rather than suppressing them"],"tags":["rx","argument-null","zip","csharp"],"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"}