{"record":{"id":"e2089161e6fadff2","repo":"File-New-Project/EarTrumpet","slug":"bad-number-of","errorCode":null,"errorMessage":"bad number of /","messagePattern":"bad number of /","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"EarTrumpet/UI/Themes/BrushValueParser.cs","lineNumber":255,"sourceCode":"            var parts = colorName.Split('/');\r\n            if (parts.Length == 1)\r\n            {\r\n                // Nothing to do.\r\n            }\r\n            else if (parts.Length == 2)\r\n            {\r\n                opacity = double.Parse(parts[1], CultureInfo.InvariantCulture);\r\n                colorName = parts[0];\r\n            }\r\n            else if (parts.Length == 3)\r\n            {\r\n                opacity = double.Parse(parts[1], CultureInfo.InvariantCulture);\r\n                opacityNoTransparency = double.Parse(parts[2], CultureInfo.InvariantCulture);\r\n                colorName = parts[0];\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException(\"bad number of /\");\r\n            }\r\n\r\n            desiredOpacity = SystemSettings.IsTransparencyEnabled && !SystemParameters.HighContrast ? opacity : (opacityNoTransparency > 0 ? opacityNoTransparency : opacity);\r\n            return colorName;\r\n        }\r\n    }\r\n}","sourceCodeStart":237,"sourceCodeEnd":262,"githubUrl":"https://github.com/File-New-Project/EarTrumpet/blob/aa894e51c22f5f9a939b31b224c4d2d3e163416e/EarTrumpet/UI/Themes/BrushValueParser.cs#L237-L262","documentation":"ParseOpacityFromColor encodes optional alpha in the color name itself using slashes: \"Color\", \"Color/opacity\", or \"Color/opacity/opacityNoTransparency\". It splits on '/' and only accepts 1, 2, or 3 segments. Anything else (4+ segments) is a malformed value and throws NotImplementedException(\"bad number of /\").","triggerScenarios":"A theme color value is passed with more than two slashes, e.g. \"Accent/0.5/0.3/extra\" or \"Red/1/2/3\", so parts.Length >= 4 and the final else throws.","commonSituations":"Typo adding an extra slash; a reference value concatenation that accidentally appends another \"/opacity\"; copy-paste of an opacity expression with a trailing slash.","solutions":["Correct the color string to at most two slashes: \"Color\", \"Color/0.5\", or \"Color/0.5/0.3\".","Strip trailing/empty segments before splitting if user-supplied markup is the source.","Validate the segment count before calling Parse and reject malformed values early.","Check reference concatenation sites (FindReference builds \"+ opacities\") for double slashes."],"exampleFix":"// before: value = \"Accent/0.5/0.3/0.1\"\n// after:  value = \"Accent/0.5/0.3\"\n// guard:\nvar parts = colorName.Split('/');\nif (parts.Length > 3) throw new FormatException($\"Too many '/' segments: {colorName}\");","handlingStrategy":"validation","validationCode":"// validate slash count before ParseOpacityFromColor\nvar parts = colorName.Split('/');\nif (parts.Length < 1 || parts.Length > 3)\n    throw new FormatException($\"Invalid color/opacity format: '{colorName}'\");","typeGuard":null,"tryCatchPattern":"try { colorName = ParseOpacityFromColor(colorName, out var opacity); }\ncatch (NotImplementedException ex) { throw new FormatException($\"Bad opacity format: {colorName}\", ex); }","preventionTips":["Limit opacity markup to at most two slashes (Color/opacity/opacityNoTransparency).","Trim trailing slashes and empty segments from user/template markup before parsing.","Check reference concatenation sites (FindReference appends opacities) to avoid doubling slashes."],"tags":["theme","brush","opacity","wpf","markup","validation","eartrumpet-ui"],"backgroundTag":null,"analyzedSha":"aa894e51c22f5f9a939b31b224c4d2d3e163416e","analyzedAt":"2026-08-13T18:51:30.564Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}