{"record":{"id":"9fdf8ff3ee7d5f20","repo":"dotnet/reactive","slug":"second-qbservableex-homoicon","errorCode":null,"errorMessage":"second","messagePattern":"second","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs","lineNumber":37,"sourceCode":"{\n    public static partial class QbservableEx\n    {\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence of tuple values whenever any of the observable sequences produces an element.\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        /// <param name=\"first\">First observable source.</param>\n        /// <param name=\"second\">Second 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\">\n        /// <paramref name=\"first\" /> or <paramref name=\"second\" /> is null.</exception>\n        public static IQbservable<(TFirst First, TSecond Second)> CombineLatest<TFirst, TSecond>(this IQbservable<TFirst> first, IObservable<TSecond> second)\n        {\n            if (first == null)\n                throw new ArgumentNullException(nameof(first));\n            if (second == null)\n                throw new ArgumentNullException(nameof(second));\n\n            return first.Provider.CreateQuery<(TFirst First, TSecond Second)>(\n                Expression.Call(\n                    null,\n                    new Func<IQbservable<TFirst>, IObservable<TSecond>, IQbservable<(TFirst First, TSecond Second)>>(CombineLatest<TFirst, TSecond>).Method,\n                    first.Expression,\n                    GetSourceExpression(second)\n                )\n            );\n        }\n\n        /// <summary>\n        /// Merges the specified observable sequences into one observable sequence of tuple values whenever any of the observable sequences produces an element.\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        /// <param name=\"first\">First observable source.</param>","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs#L19-L55","documentation":"QbservableEx.CombineLatest<TFirst,TSecond> throws ArgumentNullException when the second (IObservable) source is null. Both inputs are combined element-wise into tuples inside the query expression, so a null second sequence cannot be represented and is rejected immediately.","triggerScenarios":"Calling first.CombineLatest(null) or passing an IObservable<TSecond> variable that was never initialized; event streams or sensor observables that failed to be created upstream.","commonSituations":"Wiring UI or telemetry streams where one stream's factory returned null; optional streams not replaced by Observable.Never/Empty; DI misconfiguration leaving a stream dependency unset.","solutions":["Ensure the second observable is instantiated (e.g. Observable.FromEventPattern, Subject, or another factory).","Null-check both inputs before combining; for an optional stream use second ?? Observable.Never<TSecond>().","Fix the upstream factory or DI registration that returned a null observable."],"exampleFix":"// before\nIObservable<string> second = null;\nvar combined = first.CombineLatest(second);\n// after\nIObservable<string> second = otherStream ?? Observable.Never<string>();\nvar combined = first.CombineLatest(second);","handlingStrategy":"validation","validationCode":"if (first is null || second is null) throw new InvalidOperationException(\"CombineLatest requires non-null first and second sources.\");","typeGuard":null,"tryCatchPattern":"try { var combined = first.CombineLatest(second); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"second\") { /* instantiate the second observable */ }","preventionTips":["Instantiate all observables before composition; use Observable.Never for optional streams.","Check event-stream factories never return null.","Validate DI bindings for observable dependencies at container build time."],"tags":["csharp","null-reference","argument-validation","rx","observable"],"backgroundTag":"null-argument","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}