{"record":{"id":"8548499e14f186c4","repo":"dotnet/maui","slug":"xc0042","errorCode":"XC0042","errorMessage":"Binding: Indexer did not contain arguments.","messagePattern":"Binding: Indexer did not contain arguments\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs","lineNumber":835,"sourceCode":"\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{\n\t\t\t\t\t\t// When the source type was inferred from RelativeSource AncestorType (rather\n\t\t\t\t\t\t// than an explicit x:DataType), a missing property doesn't necessarily mean the\n\t\t\t\t\t\t// binding is invalid - the actual runtime ancestor may be a subtype that declares\n\t\t\t\t\t\t// the property. Silently fall back to a regular (reflection-based) Binding instead","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs#L817-L853","documentation":"Thrown when an indexer in a compiled-binding path has brackets but the argument length between them is zero (i.e. `[]`). The compiler computes argLength = rbIndex - lbIndex - 1 and throws BindingIndexerEmpty when it is 0.","triggerScenarios":"A binding path indexer with no argument at all, e.g. `{Binding Items[]}`.","commonSituations":"Typing empty brackets while sketching a binding; leftover placeholder after refactoring.","solutions":["Provide a concrete index argument inside the brackets.","If indexing is not intended, remove the brackets entirely.","Verify the argument matches the indexer key type (int/string/enum)."],"exampleFix":"<!-- before -->\n<Label Text=\"{Binding Items[]}\" />\n\n<!-- after -->\n<Label Text=\"{Binding Items[0]}\" />","handlingStrategy":"validation","validationCode":"// Reject empty indexer brackets\nstatic bool IndexersHaveContent(string path) =>\n    !path.Split('.').Any(seg => seg.Contains(\"[]\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave empty '[]' in a binding path.","Fill in the index argument before building.","Remove brackets you do not need."],"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"}