{"record":{"id":"06eab6e386761e89","repo":"dotnet/maui","slug":"xc0041","errorCode":"XC0041","errorMessage":"Binding: Indexer did not contain closing bracket.","messagePattern":"Binding: Indexer did not contain closing bracket\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs","lineNumber":831,"sourceCode":"\n\t\t\tif (string.IsNullOrWhiteSpace(path))\n\t\t\t\treturn true;\n\n\t\t\tpath = path.Trim(' ', '.'); //trim leading or trailing dots\n\t\t\tvar parts = path.Split(['.'], StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar properties = new List<(PropertyDefinition property, TypeReference propDeclTypeRef, string indexArg)>();\n\n\t\t\tvar previousPartTypeRef = tSourceRef;\n\t\t\tforeach (var part in parts)\n\t\t\t{\n\t\t\t\tvar p = part;\n\t\t\t\tstring indexArg = null;\n\t\t\t\tvar lbIndex = p.IndexOf('[');\n\t\t\t\tif (lbIndex != -1)\n\t\t\t\t{\n\t\t\t\t\tvar rbIndex = p.LastIndexOf(']');\n\t\t\t\t\tif (rbIndex == -1)\n\t\t\t\t\t\tthrow new BuildException(BindingIndexerNotClosed, lineInfo, null);\n\n\t\t\t\t\tvar argLength = rbIndex - lbIndex - 1;\n\t\t\t\t\tif (argLength == 0)\n\t\t\t\t\t\tthrow new BuildException(BindingIndexerEmpty, lineInfo, null);\n\n\t\t\t\t\tindexArg = p.Substring(lbIndex + 1, argLength).Trim();\n\t\t\t\t\tif (indexArg.Length == 0)\n\t\t\t\t\t\tthrow new BuildException(BindingIndexerEmpty, lineInfo, null);\n\n\t\t\t\t\tp = p.Substring(0, lbIndex);\n\t\t\t\t\tp = p.Trim();\n\t\t\t\t}\n\n\t\t\t\tif (p.Length > 0)\n\t\t\t\t{\n\t\t\t\t\tvar property = previousPartTypeRef.GetProperty(context.Cache, pd => pd.Name == p && pd.GetMethod != null && pd.GetMethod.IsPublic && !pd.GetMethod.IsStatic, out var propDeclTypeRef);\n\t\t\t\t\tif (property is null)\n\t\t\t\t\t{","sourceCodeStart":813,"sourceCodeEnd":849,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs#L813-L849","documentation":"Thrown while parsing a compiled-binding path when a path segment contains '[' but no matching ']'. The parser uses LastIndexOf(']') and throws BindingIndexerNotClosed when it returns -1.","triggerScenarios":"A binding path with an unterminated indexer, e.g. `{Binding Items[0}`.","commonSituations":"Manual editing of a binding path that drops the closing bracket; malformed copy-paste.","solutions":["Add the missing closing ']' to complete the indexer.","Re-check the whole path string for balanced brackets.","If you did not intend an indexer, remove the '['."],"exampleFix":"<!-- before -->\n<Label Text=\"{Binding Items[0}\" />\n\n<!-- after -->\n<Label Text=\"{Binding Items[0]}\" />","handlingStrategy":"validation","validationCode":"// A binding path segment with '[' must have a closing ']'\nstatic bool IndexersClosed(string path)\n    => path.Split('.').All(seg => seg.Count(c => c == '[') == 0\n        || seg.Contains(']'));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always balance '[' and ']' in binding paths.","Re-read the path after editing indexer expressions.","If not indexing, do not leave a stray '['."],"tags":["xaml","xamlc","compiled-bindings","indexer","binding-path"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}