{"record":{"id":"52f3d235bc815dd6","repo":"stride3d/stride","slug":"sigmaratio-cannot-be-0-0f","errorCode":null,"errorMessage":"SigmaRatio cannot be < 0.0f","messagePattern":"SigmaRatio cannot be < 0\\.0f","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/GaussianBlur/GaussianBlur.cs","lineNumber":82,"sourceCode":"        /// <summary>\n        /// Gets or sets the sigma ratio. The sigma ratio is used to calculate the sigma based on the radius: The actual\n        /// formula is <c>sigma = radius / SigmaRatio</c>. The default value is 2.0f.\n        /// </summary>\n        /// <value>The sigma ratio.</value>\n        /// <userdoc>The sigma ratio of the Gaussian. The sigma ratio is used to calculate the sigma of the Gaussian. \n        /// The actual formula is <c>sigma = radius / SigmaRatio</c></userdoc>\n        [DataMember(20)]\n        public float SigmaRatio\n        {\n            get\n            {\n                return sigmaRatio;\n            }\n            set\n            {\n                if (value < 0.0f)\n                {\n                    throw new ArgumentOutOfRangeException(\"SigmaRatio cannot be < 0.0f\");\n                }\n\n                sigmaRatio = value;\n            }\n        }\n\n        public void Collect(RenderContext context)\n        {\n        }\n\n        protected override void DrawCore(RenderDrawContext context)\n        {\n            // Find gaussian blur shader (if same radius has already been used)\n            GaussianBlurShader matchingGaussianBlurShader = null;\n            foreach (var gaussianBlurShader in shaders)\n            {\n                if (gaussianBlurShader.Radius == Radius)\n                {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/GaussianBlur/GaussianBlur.cs#L64-L100","documentation":"Thrown by the GaussianBlur.SigmaRatio setter when the assigned value is less than 0. SigmaRatio converts the radius into the Gaussian sigma (sigma = radius / SigmaRatio); a negative ratio yields an invalid sigma and an unusable blur kernel, so the setter rejects it with ArgumentOutOfRangeException.","triggerScenarios":"Assigning a negative value to GaussianBlur.SigmaRatio, e.g. via a sign error in a formula or a config that accepts signed numbers.","commonSituations":"Loading sigma ratio from user/config data without validation; inverting a value that shouldn't be inverted; template parameters propagating a negative tuning constant.","solutions":["Clamp: SigmaRatio = Math.Max(0f, value)","Fix the source formula/config producing the negative value","Use the default ratio by not setting the property"],"exampleFix":"// before\nblur.SigmaRatio = ratio;\n// after\nblur.SigmaRatio = Math.Max(0f, ratio);","handlingStrategy":"validation","validationCode":"if (ratio < 0f) ratio = 0f; blur.SigmaRatio = ratio;","typeGuard":"bool IsValidSigmaRatio(float r) => r >= 0f && !float.IsNaN(r);","tryCatchPattern":"try { blur.SigmaRatio = value; } catch (ArgumentOutOfRangeException) { blur.SigmaRatio = 0f; }","preventionTips":["Clamp ratio to >= 0 before assignment","Validate tuning constants coming from config or UI","Check sign of computed values (e.g. after negation or subtraction)"],"tags":["csharp","argumentoutofrange","gaussianblur","rendering"],"backgroundTag":"argument-out-of-range","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}