{"record":{"id":"7417b6e15c12f257","repo":"dotnet/wpf","slug":"sr-format-sr-propertymustbegreaterthanzero-propertyname","errorCode":null,"errorMessage":"SR.Format(SR.PropertyMustBeGreaterThanZero, propertyName)","messagePattern":"SR\\.Format\\(SR\\.PropertyMustBeGreaterThanZero, propertyName\\)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/CompositeFontParser.cs","lineNumber":49,"sourceCode":"            else if (value < -Constants.GreatestMutiplierOfEm)\n            {\n                value = -Constants.GreatestMutiplierOfEm;\n            }\n        }\n\n        internal static void VerifyPositiveMultiplierOfEm(string propertyName, ref double value)\n        {\n            if (double.IsNaN(value))\n            {\n                throw new ArgumentException(SR.Format(SR.PropertyValueCannotBeNaN, propertyName));\n            }\n            else if (value > Constants.GreatestMutiplierOfEm)\n            {\n                value = Constants.GreatestMutiplierOfEm;\n            }\n            else if (value <= 0)\n            {\n                throw new ArgumentException(SR.Format(SR.PropertyMustBeGreaterThanZero, propertyName));\n            }\n        }\n\n        internal static void VerifyNonNegativeMultiplierOfEm(string propertyName, ref double value)\n        {\n            if (double.IsNaN(value))\n            {\n                throw new ArgumentException(SR.Format(SR.PropertyValueCannotBeNaN, propertyName));\n            }\n            else if (value > Constants.GreatestMutiplierOfEm)\n            {\n                value = Constants.GreatestMutiplierOfEm;\n            }\n            else if (value < 0)\n            {\n                throw new ArgumentException(SR.Format(SR.PropertyCannotBeNegative, propertyName));\n            }\n        }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/CompositeFontParser.cs#L31-L67","documentation":"CompositeFontParser.ValidateMultiplier throws ArgumentException via VerifyPositiveMultiplierOfEm when a composite font property that must be a strictly positive em-multiplier is <= 0 (NaN is also rejected by the first branch). The parser clamps oversized values but treats zero/negative as a hard error because the property would be meaningless for a font.","triggerScenarios":"Parsing a .CompositeFont file whose width/height/scale-factor style attribute is 0, negative, or NaN, e.g. via GlyphTypeface/Typeface font family lookup, or calling VerifyPositiveMultiplierOfEm directly with a non-positive double.","commonSituations":"Hand-edited or machine-generated CompositeFont XML with a bad multiplier value (e.g. Width=\"0\"), localization of font family resources, programmatic font-family construction.","solutions":["Open the .CompositeFont XML and fix the offending attribute to a value > 0","Validate the value with double.IsNaN(v) && v > 0 before passing it to the parser","Ensure the font family resource files were not truncated or corrupted during deployment"],"exampleFix":"<!-- before -->\n<Glyphs Width=\"0\" Height=\"-1.5\" />\n<!-- after -->\n<Glyphs Width=\"1.0\" Height=\"1.0\" />","handlingStrategy":"validation","validationCode":"if (double.IsNaN(value) || value <= 0)\n    throw new ArgumentException($\"{name} must be > 0, got {value}\");","typeGuard":"bool IsValidPositiveMultiplier(double v) => !double.IsNaN(v) && v > 0;","tryCatchPattern":null,"preventionTips":["Validate CompositeFont attributes before parsing","Never hardcode 0 or negative defaults for em multipliers","Add unit tests covering NaN, 0, and negative inputs"],"tags":["wpf","fonts","composite-font","argument-out-of-range"],"backgroundTag":"argument-out-of-range","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}