{"record":{"id":"109ebad0980a984b","repo":"AvaloniaUI/Avalonia","slug":"invalid-bool-rule-109eba","errorCode":null,"errorMessage":"Invalid bool rule","messagePattern":"Invalid bool rule","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Media/PathMarkupParser.cs","lineNumber":553,"sourceCode":"            span = SkipWhitespace(span);\n            \n            if (span.IsEmpty)\n            {\n                throw new InvalidDataException(\"Invalid bool rule.\");\n            }\n            \n            var c = span[0];\n            \n            span = span.Slice(1);\n            \n            switch (c)\n            {\n                case '0':\n                    return false;\n                case '1':\n                    return true;\n                default:\n                    throw new InvalidDataException(\"Invalid bool rule\");\n            }\n        }\n\n        private static double ReadDouble(ref ReadOnlySpan<char> span)\n        {\n            if (!ReadArgument(ref span, out var doubleValue))\n            {\n                throw new InvalidDataException(\"Invalid double value\");\n            }\n\n            return double.Parse(doubleValue.ToString(), CultureInfo.InvariantCulture);\n        }\n\n        private static Size ReadSize(ref ReadOnlySpan<char> span)\n        {\n            var width = ReadDouble(ref span);\n            span = ReadSeparator(span);\n            var height = ReadDouble(ref span);","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Media/PathMarkupParser.cs#L535-L571","documentation":"Thrown by ReadBool's switch when the flag character read is neither '0' nor '1'. Arc boolean flags must be a single ASCII digit; any other character (a letter, '2'-'9', 'true'/'false', a sign) lands here.","triggerScenarios":"Arc commands with non-binary flags, e.g. 'A5,5 0 true 1 10,0' or 'A5,5 0 2 1 10,0'.","commonSituations":"Using boolean words ('true'/'false') instead of 0/1; copying flags from a format that uses different tokens; OCR/copy-paste introducing a wrong glyph.","solutions":["Use only '0' or '1' for both the large-arc-flag and the sweep-flag.","Replace 'true'/'false' with '1'/'0' respectively.","Re-validate the arc segment token against the SVG arc grammar (7 numeric-or-flag args)."],"exampleFix":"// before\ngeometry.Parse(\"M0,0 A5,5 0 true false 10,0\");\n\n// after\ngeometry.Parse(\"M0,0 A5,5 0 1 0 10,0\");","handlingStrategy":"validation","validationCode":"if (flagChar is not ('0' or '1')) flagChar = (value ? '1' : '0');","typeGuard":"static bool IsBoolFlagChar(char c) => c is '0' or '1';","tryCatchPattern":"try { parser.Parse(data); }\ncatch (InvalidDataException ex) when (ex.Message == \"Invalid bool rule\")\n{ /* non-binary arc flag — sanitize to 0/1 */ }","preventionTips":["Normalize 'true'/'false' to '1'/'0' before parsing.","Reject digits 2-9 and letters in arc-flag positions at the data source."],"tags":["avalonia","path-markup","arc","invalid-data","parse"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}