{"record":{"id":"180de826f4dc7fbc","repo":"dotnet/reactive","slug":"right-qbservable-joins","errorCode":null,"errorMessage":"right","messagePattern":"right","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Joins.cs","lineNumber":34,"sourceCode":"        /// <summary>\n        /// Creates a pattern that matches when both observable sequences have an available element.\n        /// </summary>\n        /// <typeparam name=\"TLeft\">The type of the elements in the left sequence.</typeparam>\n        /// <typeparam name=\"TRight\">The type of the elements in the right sequence.</typeparam>\n        /// <param name=\"left\">Observable sequence to match with the right sequence.</param>\n        /// <param name=\"right\">Observable sequence to match with the left sequence.</param>\n        /// <returns>Pattern object that matches when both observable sequences have an available element.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"left\"/> or <paramref name=\"right\"/> is null.</exception>\n        public static QueryablePattern<TLeft, TRight> And<TLeft, TRight>(this IQbservable<TLeft> left, IObservable<TRight> right)\n        {\n            if (left == null)\n            {\n                throw new ArgumentNullException(nameof(left));\n            }\n\n            if (right == null)\n            {\n                throw new ArgumentNullException(nameof(right));\n            }\n\n            return new QueryablePattern<TLeft, TRight>(\n                Expression.Call(\n                    null,\n                    new Func<IQbservable<TLeft>, IObservable<TRight>, QueryablePattern<TLeft, TRight>>(And).Method,\n                    left.Expression,\n                    GetSourceExpression(right)\n                )\n            );\n        }\n\n        /// <summary>\n        /// Matches when the observable sequence has an available element and projects the element by invoking the selector function.\n        /// </summary>\n        /// <typeparam name=\"TSource\">The type of the elements in the source sequence.</typeparam>\n        /// <typeparam name=\"TResult\">The type of the elements in the result sequence, returned by the selector function.</typeparam>\n        /// <param name=\"source\">Observable sequence to apply the selector on.</param>","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Qbservable.Joins.cs#L16-L52","documentation":"And(left, right) requires the right-hand IObservable<TRight> to be non-null; the method throws ArgumentNullException(\"right\") before building the Expression.Call that embeds the And call into the queryable expression tree. The right sequence is a plain IObservable operand of the pattern, and a null reference cannot be represented in the expression.","triggerScenarios":"Calling left.And(null) or passing a right-hand observable variable that is null, commonly obtained from a failed lookup or uninitialized field.","commonSituations":"Composing patterns where the second stream comes from another service or event hookup that has not been initialized yet.","solutions":["Pass a valid IObservable<TRight>, e.g. Observable.Empty<TRight>() as a safe placeholder.","Initialize/await the right-hand stream before composing the And pattern.","Guard with a null check and skip pattern construction if the right stream is unavailable."],"exampleFix":"// before\nvar pattern = left.And(rightStream); // rightStream == null\n// after\nvar pattern = left.And(rightStream ?? Observable.Empty<TRight>());","handlingStrategy":"validation","validationCode":"if (right is null) right = Observable.Empty<TRight>();\nvar pattern = left.And(right);","typeGuard":"bool HasRightStream<TR>(IObservable<TR>? r) => r is not null;","tryCatchPattern":"try { var pattern = left.And(right); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"right\") { var pattern = left.And(Observable.Empty<TRight>()); }","preventionTips":["Initialize secondary streams before composing join patterns","Use empty-observable placeholders when a stream is temporarily absent","Assert non-null on streams received from external services"],"tags":["argument-null","qbservable","join-pattern","rx","dotnet"],"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"}