{"record":{"id":"e2aeb5df712471b8","repo":"dotnet/reactive","slug":"value-cannot-be-null-parameter-sixth-observable-multiple-zip","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'sixth')","messagePattern":"Value cannot be null\\. \\(Parameter 'sixth'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs","lineNumber":1316,"sourceCode":"        /// <param name=\"fourth\">Fourth observable source.</param>\n        /// <param name=\"fifth\">Fifth observable source.</param>\n        /// <param name=\"sixth\">Sixth 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\"/> or <paramref name=\"sixth\"/> is null.</exception>\n        public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth)> Zip<TFirst, TSecond, TThird, TFourth, TFifth, TSixth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth)\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            if (sixth == null)\n                throw new ArgumentNullException(nameof(sixth));\n\n            return s_impl.Zip(first, second, third, fourth, fifth, sixth);\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        /// <typeparam name=\"TSeventh\">The type of the elements in the seventh 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>","sourceCodeStart":1298,"sourceCodeEnd":1334,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.Zip.cs#L1298-L1334","documentation":"The six-source Zip overload throws ArgumentNullException when any of its six observable arguments is null; this error reports the sixth argument being null. The validation happens synchronously in the public Zip method at Observable.Multiple.Zip.cs:1316, so the call fails immediately and never returns an observable. Rx enforces this contract to prevent deferred failures inside the query.","triggerScenarios":"Calling Observable.Zip(first, second, third, fourth, fifth, sixth) with the sixth IObservable<TSixth> argument null — e.g. a subject never initialized, a method returning null for a missing stream, or a config-driven source not created.","commonSituations":"Combining six UI/event streams where the last source is optional and left null; pipeline code where a late-added sixth source isn't wired in older code paths; DI containers missing a registration for the sixth stream.","solutions":["Fix the construction of the sixth observable so it is non-null before the Zip call.","Substitute Observable.Empty<TSixth>() when the source is intentionally absent.","Guard the argument at the call site with ArgumentNullException.ThrowIfNull to fail with clearer context.","Enable nullable reference types and mark the source as nullable so the compiler surfaces the issue before runtime."],"exampleFix":"// before\nvar zipped = Observable.Zip(a, b, c, d, e, sixth); // sixth == null\n\n// after\nvar zipped = Observable.Zip(a, b, c, d, e, sixth ?? Observable.Empty<TSixth>());","handlingStrategy":"validation","validationCode":"if (sixth is null)\n    throw new InvalidOperationException(\"Sixth Zip source is null; ensure the sixth observable stream is initialized before zipping.\");","typeGuard":"static bool HasSixthSource<T6>(IObservable<T6> sixth) => sixth is not null;","tryCatchPattern":"try\n{\n    zipped = Observable.Zip(first, second, third, fourth, fifth, sixth);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"sixth\")\n{\n    zipped = Observable.Zip(first, second, third, fourth, fifth, Observable.Empty<TSixth>());\n}","preventionTips":["Initialize every subject before composing queries; audit late-constructed sources.","Use Observable.Empty<T>() for intentionally missing sources.","Fail fast in your own factory methods with ArgumentNullException.ThrowIfNull.","Check DI/config wiring for each of the six sources.","Prefer property initializers over null fields for Rx streams."],"tags":["dotnet","reactive-extensions","null-argument","zip"],"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"}