{"record":{"id":"e65df410d292514f","repo":"dotnet/reactive","slug":"argumentnullexception-observable-single","errorCode":null,"errorMessage":"ArgumentNullException","messagePattern":"ArgumentNullException","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Single.cs","lineNumber":26,"sourceCode":"namespace System.Reactive.Linq\n{\n    public static partial class Observable\n    {\n        #region + Append +\n\n        /// <summary>\n        /// Append a value to an observable sequence.\n        /// </summary>\n        /// <typeparam name=\"TSource\">The type of the elements in the source sequence.</typeparam>\n        /// <param name=\"source\">Source sequence to append the value to.</param>\n        /// <param name=\"value\">Value to append to the specified sequence.</param>\n        /// <returns>The source sequence appended with the specified value.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source\"/> is null.</exception>\n        public static IObservable<TSource> Append<TSource>(this IObservable<TSource> source, TSource value)\n        {\n            if (source == null)\n            {\n                throw new ArgumentNullException(nameof(source));\n            }\n\n            return s_impl.Append(source, value);\n        }\n\n        /// <summary>\n        /// Append a value to an observable sequence.\n        /// </summary>\n        /// <typeparam name=\"TSource\">The type of the elements in the source sequence.</typeparam>\n        /// <param name=\"source\">Source sequence to append the value to.</param>\n        /// <param name=\"value\">Value to append to the specified sequence.</param>\n        /// <param name=\"scheduler\">Scheduler to emit the append values on.</param>\n        /// <returns>The source sequence appended with the specified value.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source\"/> is null.</exception>\n        public static IObservable<TSource> Append<TSource>(this IObservable<TSource> source, TSource value, IScheduler scheduler)\n        {\n            if (source == null)\n            {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Single.cs#L8-L44","documentation":"Append concatenates a single value onto the end of an observable sequence and requires a non-null source. The public extension method validates `source` eagerly and throws ArgumentNullException before any subscription occurs.","triggerScenarios":"Calling source.Append(value) where source is null — commonly a null stream from an uninitialized variable, failed lookup, or producer returning null.","commonSituations":"Chaining operators off a method that returned null instead of an empty observable; event-driven streams wired up too late; deserialized configuration with a missing stream.","solutions":["Null-check source before calling Append.","Return Observable.Empty<TSource>() from producers instead of null.","Coalesce: (source ?? Observable.Empty<T>()).Append(value)."],"exampleFix":"// before\nvar withEnd = source.Append(lastValue);\n// after\nvar withEnd = (source ?? Observable.Empty<int>()).Append(lastValue);","handlingStrategy":"validation","validationCode":"if (source is null) throw new ArgumentNullException(nameof(source));","typeGuard":"static bool IsSource<T>(IObservable<T>? s) => s is not null;","tryCatchPattern":"try { var withEnd = source.Append(value); }\ncatch (ArgumentNullException ex) { logger.LogError(ex, \"Append requires a non-null source\"); }","preventionTips":["Return Observable.Empty<T>() instead of null from factories.","Check nullable fields before building operator chains.","Run with <Nullable>enable</Nullable> to surface null-flow issues early."],"tags":["csharp","rx","argument-null"],"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"}