{"record":{"id":"c88fd547b185b76e","repo":"stride3d/stride","slug":"radius-cannot-be-1","errorCode":null,"errorMessage":"Radius cannot be < 1","messagePattern":"Radius cannot be < 1","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/GaussianBlur/GaussianBlur.cs","lineNumber":57,"sourceCode":"        }\n\n        /// <summary>\n        /// Gets or sets the radius.\n        /// </summary>\n        /// <value>The radius.</value>\n        /// <userdoc>The radius of the Gaussian in pixels</userdoc>\n        [DataMember(10)]\n        public int Radius\n        {\n            get\n            {\n                return radius;\n            }\n            set\n            {\n                if (value < 1)\n                {\n                    throw new ArgumentOutOfRangeException(\"Radius cannot be < 1\");\n                }\n\n                radius = value;\n            }\n        }\n\n        /// <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            {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/GaussianBlur/GaussianBlur.cs#L39-L75","documentation":"Thrown by the GaussianBlur.Radius setter when the assigned value is less than 1. The radius (in pixels, per the user doc) determines the size of the Gaussian kernel; a radius below 1 would produce an empty/invalid kernel, so the setter rejects it with ArgumentOutOfRangeException before storing the value.","triggerScenarios":"Assigning 0 or a negative number to GaussianBlur.Radius, or computing the radius from a formula that can yield 0 (e.g. (int)(0.5 * scale) at small scales).","commonSituations":"Integer truncation of a float radius rounding down to 0 at low resolutions; tuning experiments; migrating from effects that allowed radius 0.","solutions":["Clamp to at least 1: Radius = Math.Max(1, value)","Fix the radius computation to guarantee >= 1 (e.g. Math.Max(1, (int)Math.Ceiling(x)))","Remove/disable the blur effect entirely if no blur is wanted"],"exampleFix":"// before\nblur.Radius = (int)(radiusScale * 3f);\n// after\nblur.Radius = Math.Max(1, (int)(radiusScale * 3f));","handlingStrategy":"validation","validationCode":"if (radius < 1) radius = 1; blur.Radius = radius;","typeGuard":"bool IsValidGaussianRadius(int r) => r >= 1;","tryCatchPattern":"try { blur.Radius = value; } catch (ArgumentOutOfRangeException) { blur.Radius = 1; }","preventionTips":["Clamp radii with Math.Max(1, value) before assignment","Beware integer truncation rounding computed radii down to 0","Validate radii from external configs before applying"],"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"}