{"record":{"id":"a5c66dd1bf5bb4ed","repo":"dotnet/reactive","slug":"argumentnullexception-nameof-source-observable-multiple","errorCode":null,"errorMessage":"ArgumentNullException(nameof(source))","messagePattern":"ArgumentNullException\\(nameof\\(source\\)\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.cs","lineNumber":766,"sourceCode":"\n        #region + SkipUntil +\n\n        /// <summary>\n        /// Returns the elements from the source observable sequence only after the other observable sequence produces an element.\n        /// Starting from Rx.NET 4.0, this will subscribe to <paramref name=\"other\"/> before subscribing to <paramref name=\"source\" />\n        /// so in case <paramref name=\"other\" /> emits an element right away, elements from <paramref name=\"source\" /> are not missed.\n        /// </summary>\n        /// <typeparam name=\"TSource\">The type of the elements in the source sequence.</typeparam>\n        /// <typeparam name=\"TOther\">The type of the elements in the other sequence that indicates the end of skip behavior.</typeparam>\n        /// <param name=\"source\">Source sequence to propagate elements for.</param>\n        /// <param name=\"other\">Observable sequence that triggers propagation of elements of the source sequence.</param>\n        /// <returns>An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source\"/> or <paramref name=\"other\"/> is null.</exception>\n        public static IObservable<TSource> SkipUntil<TSource, TOther>(this IObservable<TSource> source, IObservable<TOther> other)\n        {\n            if (source == null)\n            {\n                throw new ArgumentNullException(nameof(source));\n            }\n\n            if (other == null)\n            {\n                throw new ArgumentNullException(nameof(other));\n            }\n\n            return s_impl.SkipUntil(source, other);\n        }\n\n        #endregion\n\n        #region + Switch +\n\n        /// <summary>\n        /// Transforms an observable sequence of observable sequences into an observable sequence \n        /// producing values only from the most recent observable sequence.\n        /// Each time a new inner observable sequence is received, unsubscribe from the ","sourceCodeStart":748,"sourceCodeEnd":784,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Multiple.cs#L748-L784","documentation":"System.Reactive throws ArgumentNullException when the source sequence passed to SkipUntil<TSource,TOther>(source, other) is null. SkipUntil discards source elements until the other sequence emits, but a null source is a contract violation, so the operator throws synchronously before creating the implementation.","triggerScenarios":"source.SkipUntil(other) invoked on a null IObservable<TSource>, e.g. (GetMainStream() ?? null).SkipUntil(trigger) or streamVar.SkipUntil(gate) where streamVar was never assigned.","commonSituations":"A pipeline built conditionally where the main stream step was skipped; a factory returning null for the primary stream; refactoring where an earlier Select produced null instead of an observable.","solutions":["Ensure the source expression yields a real observable; use Observable.Empty<TSource>() as a neutral default","Fix the upstream factory/lookup that returned null","Check operator chaining for a step that may return null instead of an observable"],"exampleFix":"// before\nvar result = primary.SkipUntil(gate); // primary == null\n// after\nvar result = (primary ?? Observable.Empty<int>()).SkipUntil(gate);","handlingStrategy":"validation","validationCode":"if (source is null) throw new InvalidOperationException(\"SkipUntil requires a non-null source stream\");\nvar result = source.SkipUntil(other);","typeGuard":"static bool IsStream<T>(IObservable<T>? o) => o is not null;","tryCatchPattern":"try\n{\n    result = source.SkipUntil(other);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"source\")\n{\n    result = Observable.Empty<TSource>();\n}","preventionTips":["Build pipelines from non-null roots; default missing streams to Observable.Empty","Avoid conditionally skipping pipeline construction steps that leave null streams","Use nullable annotations on factory return types"],"tags":["csharp","rxjs","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"}