{"record":{"id":"2f859e7931bdf8d5","repo":"dotnet/reactive","slug":"collectionselector","errorCode":null,"errorMessage":"collectionSelector","messagePattern":"collectionSelector","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"AsyncRx.NET/System.Reactive.Async/Linq/Operators/SelectMany.cs","lineNumber":58,"sourceCode":"            return CreateAsyncObservable<TResult>.From(\n                source,\n                selector,\n                static async (source, selector, observer) =>\n                {\n                    var (sink, inner) = AsyncObserver.SelectMany(observer, selector);\n\n                    var subscription = await source.SubscribeSafeAsync(sink).ConfigureAwait(false);\n\n                    return StableCompositeAsyncDisposable.Create(subscription, inner);\n                });\n        }\n\n        public static IAsyncObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncObservable<TSource> source, Func<TSource, IAsyncObservable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)\n        {\n            if (source == null)\n                throw new ArgumentNullException(nameof(source));\n            if (collectionSelector == null)\n                throw new ArgumentNullException(nameof(collectionSelector));\n            if (resultSelector == null)\n                throw new ArgumentNullException(nameof(resultSelector));\n\n            return CreateAsyncObservable<TResult>.From(\n                source,\n                (collectionSelector, resultSelector),\n                static async (source, state, observer) =>\n                {\n                    var (sink, inner) = AsyncObserver.SelectMany(observer, state.collectionSelector, state.resultSelector);\n\n                    var subscription = await source.SubscribeSafeAsync(sink).ConfigureAwait(false);\n\n                    return StableCompositeAsyncDisposable.Create(subscription, inner);\n                });\n        }\n\n        public static IAsyncObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncObservable<TSource> source, Func<TSource, ValueTask<IAsyncObservable<TCollection>>> collectionSelector, Func<TSource, TCollection, ValueTask<TResult>> resultSelector)\n        {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/AsyncRx.NET/System.Reactive.Async/Linq/Operators/SelectMany.cs#L40-L76","documentation":"In the three-argument SelectMany overload, collectionSelector produces the inner observables; null is rejected because the per-element expansion cannot be computed. Fix: pass a non-null Func<TSource, IAsyncObservable<TCollection>>.","triggerScenarios":"Thrown at AsyncRx.NET/System.Reactive.Async/Linq/Operators/SelectMany.cs:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-null Func<TSource, IAsyncObservable<TCollection>>.","Flatten to the two-type-parameter SelectMany if only one projection is needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}