{"record":{"id":"4728a6afd551b67d","repo":"dotnet/reactive","slug":"progress-parameter-progress","errorCode":null,"errorMessage":"progress (Parameter 'progress')","messagePattern":"progress \\(Parameter 'progress'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Platforms/WinRT/Foundation/AsyncInfoExtensions.cs","lineNumber":79,"sourceCode":"        /// <summary>\n        /// Converts a Windows Runtime asynchronous action to an observable sequence, reporting its progress through the supplied progress object.\n        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.\n        /// </summary>\n        /// <typeparam name=\"TProgress\">The type of the reported progress objects.</typeparam>\n        /// <param name=\"source\">Asynchronous action to convert.</param>\n        /// <param name=\"progress\">Progress object to receive progress notifications on.</param>\n        /// <returns>An observable sequence that produces a unit value when the asynchronous action completes, or propagates the exception produced by the asynchronous action.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source\"/> or <paramref name=\"progress\"/> is null.</exception>\n        public static IObservable<Unit> ToObservable<TProgress>(this IAsyncActionWithProgress<TProgress> source, IProgress<TProgress> progress)\n        {\n            if (source == null)\n            {\n                throw new ArgumentNullException(nameof(source));\n            }\n\n            if (progress == null)\n            {\n                throw new ArgumentNullException(nameof(progress));\n            }\n\n            return source.ToObservable_(progress);\n        }\n\n        /// <summary>\n        /// Converts a Windows Runtime asynchronous action to an observable sequence reporting its progress.\n        /// Each observer subscribed to the resulting observable sequence will be notified about the action's successful or exceptional completion.\n        /// </summary>\n        /// <typeparam name=\"TProgress\">The type of the reported progress objects.</typeparam>\n        /// <param name=\"source\">Asynchronous action to convert.</param>\n        /// <returns>An observable sequence that produces progress values from the asynchronous action and notifies observers about the action's completion.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source\"/> is null.</exception>\n        public static IObservable<TProgress> ToObservableProgress<TProgress>(this IAsyncActionWithProgress<TProgress> source)\n        {\n            if (source == null)\n            {\n                throw new ArgumentNullException(nameof(source));","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Platforms/WinRT/Foundation/AsyncInfoExtensions.cs#L61-L97","documentation":"ToObservable(this IAsyncActionWithProgress<TProgress>, IProgress<TProgress>) throws ArgumentNullException when the progress parameter is null. The extension requires an IProgress<TProgress> receiver to forward WinRT progress reports into the observable pipeline before delegating to the internal ToObservable_ helper. Passing null means there is no destination for progress notifications, so the call is rejected immediately.","triggerScenarios":"Calling source.ToObservable(progress) on an IAsyncActionWithProgress<TProgress> with progress == null, e.g. from a variable that was never initialized or a method parameter forwarded straight through.","commonSituations":"Forwarding an optional IProgress<TProgress> that the caller left null; calling from generated WinRT interop code where the progress argument was defaulted to null; refactoring from the progress-less ToObservable() overload but keeping a null second argument.","solutions":["Pass a non-null IProgress<TProgress> implementation (e.g. new Progress<TProgress>(p => ...) or an observer's ToProgress()).","If you don't need progress reports, call the single-argument overload source.ToObservable() (IAsyncActionWithProgress without progress) or ToObservableProgress() instead.","Guard the value before calling: if (progress == null) progress = new Progress<TProgress>(_ => { }); or throw a more descriptive error at your own boundary."],"exampleFix":"// before\nvar sub = actionWithProgress.ToObservable(null).Subscribe(onNext);\n// after\nvar progress = new Progress<double>(p => Console.WriteLine($\"{p:P}\"));\nvar sub = actionWithProgress.ToObservable(progress).Subscribe(onNext);","handlingStrategy":"validation","validationCode":"if (progress is null) throw new ArgumentNullException(nameof(progress));\nvar sub = actionWithProgress.ToObservable(progress);","typeGuard":"bool HasProgress<TProgress>(IProgress<TProgress>? p) => p is not null;","tryCatchPattern":"try { var sub = action.ToObservable(progress); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"progress\") { /* supply default progress or surface error */ }","preventionTips":["Never forward optional IProgress parameters without coalescing nulls.","Use the single-argument overload when progress is unnecessary.","Default to new Progress<T>(_ => { }) as a no-op sink."],"tags":["argumentnull","winrt","rx","progress"],"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"}