{"record":{"id":"2f8d56f2e867991a","repo":"dotnet/reactive","slug":"throw-new-argumentnullexception-nameof-sixteenth","errorCode":null,"errorMessage":"throw new ArgumentNullException(nameof(sixteenth))","messagePattern":"throw new ArgumentNullException\\(nameof\\(sixteenth\\)\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs","lineNumber":926,"sourceCode":"                throw new ArgumentNullException(nameof(seventh));\n            if (eighth == null)\n                throw new ArgumentNullException(nameof(eighth));\n            if (ninth == null)\n                throw new ArgumentNullException(nameof(ninth));\n            if (tenth == null)\n                throw new ArgumentNullException(nameof(tenth));\n            if (eleventh == null)\n                throw new ArgumentNullException(nameof(eleventh));\n            if (twelfth == null)\n                throw new ArgumentNullException(nameof(twelfth));\n            if (thirteenth == null)\n                throw new ArgumentNullException(nameof(thirteenth));\n            if (fourteenth == null)\n                throw new ArgumentNullException(nameof(fourteenth));\n            if (fifteenth == null)\n                throw new ArgumentNullException(nameof(fifteenth));\n            if (sixteenth == null)\n                throw new ArgumentNullException(nameof(sixteenth));\n\n            return first.Provider.CreateQuery<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh, TTwelfth Twelfth, TThirteenth Thirteenth, TFourteenth Fourteenth, TFifteenth Fifteenth, TSixteenth Sixteenth)>(\n                Expression.Call(\n                    null,\n                    new Func<IQbservable<TFirst>, IObservable<TSecond>, IObservable<TThird>, IObservable<TFourth>, IObservable<TFifth>, IObservable<TSixth>, IObservable<TSeventh>, IObservable<TEighth>, IObservable<TNinth>, IObservable<TTenth>, IObservable<TEleventh>, IObservable<TTwelfth>, IObservable<TThirteenth>, IObservable<TFourteenth>, IObservable<TFifteenth>, IObservable<TSixteenth>, IQbservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth, TNinth Ninth, TTenth Tenth, TEleventh Eleventh, TTwelfth Twelfth, TThirteenth Thirteenth, TFourteenth Fourteenth, TFifteenth Fifteenth, TSixteenth Sixteenth)>>(CombineLatest<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TEighth, TNinth, TTenth, TEleventh, TTwelfth, TThirteenth, TFourteenth, TFifteenth, TSixteenth>).Method,\n                    first.Expression,\n                    GetSourceExpression(second),\n                    GetSourceExpression(third),\n                    GetSourceExpression(fourth),\n                    GetSourceExpression(fifth),\n                    GetSourceExpression(sixth),\n                    GetSourceExpression(seventh),\n                    GetSourceExpression(eighth),\n                    GetSourceExpression(ninth),\n                    GetSourceExpression(tenth),\n                    GetSourceExpression(eleventh),\n                    GetSourceExpression(twelfth),\n                    GetSourceExpression(thirteenth),","sourceCodeStart":908,"sourceCodeEnd":944,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/QbservableEx.Homoicon.cs#L908-L944","documentation":"QbservableEx.CombineLatest's 16-source overload validates all sixteen source sequences before building the query expression tree. If the sixteenth IObservable<TSixteenth> argument is null, it throws ArgumentNullException named 'sixteenth'. The library throws eagerly at query-composition time so the failure surfaces where the query is built, not when it is subscribed on a remote provider.","triggerScenarios":"Calling Qbservable.CombineLatest(first..fifteenth, sixteenth) where the sixteenth argument is a null IObservable reference — e.g. a variable assigned from a failed lookup, an uninitialized field, or a method returning null instead of Observable.Empty.","commonSituations":"Dynamically assembling a large tuple of observables where one member of a collection came back null; refactoring code that reduced source count and left a trailing null; interop layers wrapping legacy streams that return null on missing data.","solutions":["Pass a non-null IQbservable/IObservable as the sixteenth argument; use Observable.Empty<TSixteenth>() or Observable.Never<TSixteenth>() when no source exists","Check where the sixteenth source is produced (factory method, dictionary lookup) and fix the code returning null","Combine fewer sources if 16 are not genuinely needed, avoiding placeholder nulls"],"exampleFix":"// before\nCombineLatest(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, maybeSixteenth);\n// after\nvar sixteenth = maybeSixteenth ?? Observable.Empty<TSixteenth>();\nCombineLatest(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, sixteenth);","handlingStrategy":"validation","validationCode":"if (sixteenth == null)\n    throw new InvalidOperationException(\"sixteenth source must be provided; use Observable.Empty<TSixteenth>() instead\");","typeGuard":"bool HasSource<T>(IObservable<T> s) => s is not null;","tryCatchPattern":"try\n{\n    var query = Qbservable.CombineLatest(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, sixteenth);\n}\ncatch (ArgumentNullException ex) when (ex.ParamName == \"sixteenth\")\n{\n    logger.LogError(ex, \"16th CombineLatest source was null\");\n}","preventionTips":["Default missing sources to Observable.Empty or Observable.Never, never null","Validate all sources in a helper before composing multi-source queries","Avoid factories that can return null observables; return empty streams instead"],"tags":["argumentnull","rx","combinelatest","qbservable"],"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"}