{"record":{"id":"788ad254e5808d00","repo":"QuestPDF/QuestPDF","slug":"the-bottom-left-corner-radius-cannot-be-negative","errorCode":null,"errorMessage":"The bottom-left corner radius cannot be negative.","messagePattern":"The bottom-left corner radius cannot be negative\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/dotnet/library/QuestPDF/Fluent/StyledBoxExtensions.cs","lineNumber":172,"sourceCode":"        #endregion\n        \n        #region Corner Radius\n        \n        private static IContainer CornerRadius(this IContainer element, float? topLeft = null, float? topRight = null, float? bottomRight = null, float? bottomLeft = null)\n        {\n            var styledBox = element as StyledBox ?? new StyledBox();\n            \n            if (topLeft < 0)\n                throw new ArgumentOutOfRangeException(nameof(topLeft), \"The top-left corner radius cannot be negative.\");\n            \n            if (topRight < 0)\n                throw new ArgumentOutOfRangeException(nameof(topRight), \"The top-right corner radius cannot be negative.\");\n            \n            if (bottomRight < 0)\n                throw new ArgumentOutOfRangeException(nameof(bottomRight), \"The bottom-right corner radius cannot be negative.\");\n            \n            if (bottomLeft < 0)\n                throw new ArgumentOutOfRangeException(nameof(bottomLeft), \"The bottom-left corner radius cannot be negative.\");\n            \n            if (topLeft.HasValue)\n                styledBox.BorderRadiusTopLeft = topLeft.Value;\n            \n            if (topRight.HasValue)\n                styledBox.BorderRadiusTopRight = topRight.Value;\n            \n            if (bottomRight.HasValue)\n                styledBox.BorderRadiusBottomRight = bottomRight.Value;\n            \n            if (bottomLeft.HasValue)\n                styledBox.BorderRadiusBottomLeft = bottomLeft.Value;\n            \n            return element.Element(styledBox);\n        }\n\n        /// <summary>\n        /// Applies a uniform corner radius to all corners of the container with the specified value and unit.","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/QuestPDF/QuestPDF/blob/43ab12559671556e10a6a0a5afe542c919f48a21/src/dotnet/library/QuestPDF/Fluent/StyledBoxExtensions.cs#L154-L190","documentation":"The private CornerRadius(IContainer, float? topLeft, float? topRight, float? bottomRight, float? bottomLeft) method throws ArgumentOutOfRangeException when bottomLeft is negative. Public methods CornerRadius(float), CornerRadiusBottomLeft(float), and the uniform overload route through this guard.","triggerScenarios":"Calling container.CornerRadiusBottomLeft(-5), container.CornerRadius(-2), or the uniform overload with a negative value — any negative bottom-left radius.","commonSituations":"Computed styling from user data that goes negative; theme configs with sentinel defaults; layout subtraction errors.","solutions":["Clamp with Math.Max(0, value) before the call.","Fix the upstream computation.","Validate externally sourced values before styling."],"exampleFix":"// before\ncontainer.CornerRadiusBottomLeft(radius);\n\n// after\ncontainer.CornerRadiusBottomLeft(Math.Max(0, radius));","handlingStrategy":"validation","validationCode":"var safeRadius = Math.Max(0, bottomLeft);\ncontainer.CornerRadiusBottomLeft(safeRadius);","typeGuard":"static bool IsValidRadius(float value) => value >= 0;","tryCatchPattern":null,"preventionTips":["Clamp radius values with Math.Max(0, value) before corner-radius calls.","Guard config-driven values at the boundary.","Audit computed radius expressions for negatives."],"tags":["questpdf","styled-box","corner-radius","argument-out-of-range","validation"],"backgroundTag":null,"analyzedSha":"43ab12559671556e10a6a0a5afe542c919f48a21","analyzedAt":"2026-08-13T17:02:41.303Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}