{"record":{"id":"dc86e0d51094bc72","repo":"dotnet/wpf","slug":"sr-glyphsclusternonestedclusters","errorCode":null,"errorMessage":"SR.GlyphsClusterNoNestedClusters","messagePattern":"SR\\.GlyphsClusterNoNestedClusters","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Glyphs.cs","lineNumber":411,"sourceCode":"            ref int            glyphClusterSize,\n            ref int            characterClusterSize,\n            ref ushort         glyphIndex)\n        {\n            // the format is ... [(CharacterClusterSize[:GlyphClusterSize])] GlyphIndex ...\n            ReadOnlySpan<char> glyphIndexString = valueSpec;\n\n            int firstBracket = valueSpec.IndexOf('(');\n            if (firstBracket != -1)\n            {\n                // Only spaces are allowed before the bracket\n                for (int i=0; i<firstBracket; i++)\n                {\n                    if (!Char.IsWhiteSpace(valueSpec[i]))\n                        throw new ArgumentException(SR.GlyphsClusterBadCharactersBeforeBracket);\n                }\n\n                if (inCluster)\n                    throw new ArgumentException(SR.GlyphsClusterNoNestedClusters);\n\n                int secondBracket = valueSpec.IndexOf(')');\n                if (secondBracket == -1 || secondBracket <= firstBracket + 1)\n                    throw new ArgumentException(SR.GlyphsClusterNoMatchingBracket);\n\n                // look for colon separator\n                int colon = valueSpec.IndexOf(':');\n                if (colon == -1)\n                {\n                    // parse glyph cluster size\n                    ReadOnlySpan<char> characterClusterSpec = valueSpec.Slice(firstBracket + 1, secondBracket - (firstBracket + 1));\n                    characterClusterSize = int.Parse(characterClusterSpec, provider: CultureInfo.InvariantCulture);\n                    glyphClusterSize = 1;\n                }\n                else\n                {\n                    if (colon <= firstBracket + 1 || colon >= secondBracket - 1)\n                        throw new ArgumentException(SR.GlyphsClusterMisplacedSeparator);","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Glyphs.cs#L393-L429","documentation":"Fired from ReadGlyphIndex while parsing the Glyphs UnicodeString/Indices mini-language: a cluster specification of the form (CharacterClusterSize[:GlyphClusterSize]) was encountered while already parsing a cluster (nested '(' inside the bracketed section). Cluster specs cannot nest, so the parser rejects the malformed Indices string.","triggerScenarios":"Indices strings with nested brackets such as '(1,(2,3))' or an unclosed cluster followed by another '(' character.","commonSituations":"Malformed Indices from manual editing or buggy generators producing nested cluster groups; typos leaving a cluster unbalanced.","solutions":["Remove nested brackets so clusters are flat, e.g. '(1,2,3)'","Close every cluster with ')' before starting a new one","Validate that '(' never appears twice without an intervening ')'"],"exampleFix":"// before\nIndices=\"(1,(2,3))\"\n// after\nIndices=\"(1,2,3)\"","handlingStrategy":"validation","validationCode":"int depth = 0;\nbool ok = indices.All(c => { if (c=='(') depth++; else if (c==')') depth--; return depth <= 1; });","typeGuard":null,"tryCatchPattern":"try { glyphs.Indices = value; } catch (ArgumentException) { /* flatten nested clusters */ }","preventionTips":["Emit only flat cluster groups '(a,b,c)'","Balance-check brackets in generated Indices","Avoid string concatenation that can nest brackets"],"tags":["wpf","glyphs","indices-parsing"],"backgroundTag":"invalid-argument-format","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"}