{"record":{"id":"dfe153663ef556ca","repo":"dotnet/reactive","slug":"action","errorCode":null,"errorMessage":"action","messagePattern":"action","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"AsyncRx.NET/System.Reactive.Async/Linq/Operators/Start.cs","lineNumber":32,"sourceCode":"                throw new ArgumentNullException(nameof(function));\n\n            return ToAsync(function)();\n        }\n\n        public static IAsyncObservable<TSource> Start<TSource>(Func<TSource> function, IAsyncScheduler scheduler)\n        {\n            if (function == null)\n                throw new ArgumentNullException(nameof(function));\n            if (scheduler == null)\n                throw new ArgumentNullException(nameof(scheduler));\n\n            return ToAsync(function, scheduler)();\n        }\n\n        public static IAsyncObservable<Unit> Start(Action action)\n        {\n            if (action == null)\n                throw new ArgumentNullException(nameof(action));\n\n            return ToAsync(action)();\n        }\n\n        public static IAsyncObservable<Unit> Start(Action action, IAsyncScheduler scheduler)\n        {\n            if (action == null)\n                throw new ArgumentNullException(nameof(action));\n            if (scheduler == null)\n                throw new ArgumentNullException(nameof(scheduler));\n\n            return ToAsync(action, scheduler)();\n        }\n    }\n}\n","sourceCodeStart":14,"sourceCodeEnd":48,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/AsyncRx.NET/System.Reactive.Async/Linq/Operators/Start.cs#L14-L48","documentation":"Start(Action) throws ArgumentNullException when the action delegate passed to it is null. The library validates arguments eagerly so the failure surfaces at subscription-setup time rather than later inside the reactive pipeline. Since Start wraps the delegate in ToAsync, a null delegate cannot be meaningfully executed.","triggerScenarios":"Calling System.Reactive.Async Linq Operators.Start with a null Action, e.g. a delegate variable that was never assigned or a method group that resolved to null.","commonSituations":"Conditionally assigned delegates, refactored code where a callback field is no longer initialized, passing a result of a factory/lookup that returned null.","solutions":["Ensure a non-null Action delegate is passed to Start(action)","If the delegate may be absent, guard the call site before invoking Start","Check why the delegate source (field, factory, dictionary lookup) produced null"],"exampleFix":"// before\nAction work = GetHandler(); // may be null\nvar xs = Start(work);\n// after\nAction work = GetHandler() ?? (() => { });\nvar xs = Start(work);","handlingStrategy":"validation","validationCode":"if (action == null) throw new ArgumentNullException(nameof(action)); // or guard before calling Start","typeGuard":"static bool IsValidAction(Action a) => a is not null;","tryCatchPattern":null,"preventionTips":["Never pass nullable delegate fields directly to Start","Default-initialize delegates with no-op lambdas","Assert delegate non-nullness in unit tests"],"tags":["argument-null","reactive","async"],"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"}