{"record":{"id":"46bb10a38f6d2d4b","repo":"dotnet/reactive","slug":"argumentoutofrangeexception-default-message-specified-46bb10","errorCode":null,"errorMessage":"ArgumentOutOfRangeException (default message: Specified argument was out of the range of valid values. (Parameter 'skip'))","messagePattern":"ArgumentOutOfRangeException \\(default message: Specified argument was out of the range of valid values\\. \\(Parameter 'skip'\\)\\)","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Source/src/System.Reactive/Linq/Observable.Single.cs","lineNumber":1039,"sourceCode":"        /// <param name=\"skip\">Number of elements to skip between creation of consecutive windows.</param>\n        /// <returns>An observable sequence of windows.</returns>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"source\"/> is null.</exception>\n        /// <exception cref=\"ArgumentOutOfRangeException\"><paramref name=\"count\"/> or <paramref name=\"skip\"/> is less than or equal to zero.</exception>\n        public static IObservable<IObservable<TSource>> Window<TSource>(this IObservable<TSource> source, int count, int skip)\n        {\n            if (source == null)\n            {\n                throw new ArgumentNullException(nameof(source));\n            }\n\n            if (count <= 0)\n            {\n                throw new ArgumentOutOfRangeException(nameof(count));\n            }\n\n            if (skip <= 0)\n            {\n                throw new ArgumentOutOfRangeException(nameof(skip));\n            }\n\n            return s_impl.Window(source, count, skip);\n        }\n\n        #endregion\n    }\n}\n","sourceCodeStart":1021,"sourceCodeEnd":1048,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Source/src/System.Reactive/Linq/Observable.Single.cs#L1021-L1048","documentation":"Window(source, count, skip) requires skip > 0 and throws ArgumentOutOfRangeException naming 'skip' when skip <= 0. Skip determines how far the window start advances each time; zero or negative advances would loop or regress, so Rx rejects them eagerly.","triggerScenarios":"Calling source.Window(10, 0) or source.Window(10, -1); computing the skip from an interval/rate that can be zero (e.g. zero sampling period in config).","commonSituations":"Config where the 'stride' or 'overlap step' is set to 0; a rate/interval computed to 0 for instant processing; copy-paste overload changes where skip was accidentally replaced by 0 or a wrong variable.","solutions":["Ensure skip >= 1 before calling Window (e.g. Math.Max(1, skip))","Fix the config/computation producing the non-positive skip","If no advancement is intended, Window(count, skip) is not the right operator — reconsider the windowing strategy"],"exampleFix":"// before\nvar windows = source.Window(10, stride); // stride = 0\n// after\nvar windows = source.Window(10, Math.Max(1, stride));","handlingStrategy":"validation","validationCode":"if (skip <= 0) throw new ArgumentOutOfRangeException(nameof(skip));\nvar safeSkip = Math.Max(1, skip);","typeGuard":"bool IsValidSkip(int skip) => skip > 0;","tryCatchPattern":"try { var w = source.Window(count, skip); }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"skip\") { /* clamp skip to 1 and retry */ }","preventionTips":["Ensure stride/step config values are >= 1 at load time","Use Math.Max(1, skip) for computed skip values","Don't use Window(count, 0) expecting sliding windows; pick the correct operator or skip value"],"tags":["argument-out-of-range","rx","argument-validation"],"backgroundTag":"argument-out-of-range","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"}