{"record":{"id":"dba45e1fbf92c002","repo":"unoplatform/uno","slug":"the-property-member-member-name-of-type-prop","errorCode":null,"errorMessage":"The property '{member.Member.Name}' of type '{propertyType}' does not support adding multiple objects","messagePattern":"The property '(.+?)' of type '(.+?)' does not support adding multiple objects","errorType":"exception","errorClass":"XamlGenerationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs","lineNumber":3461,"sourceCode":"\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tforeach (var inner in member.Objects)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\twriter.AppendIndented($\"{localCollectionName}.Add(\");\n\n\t\t\t\t\t\t\t\t\t\tBuildChild(writer, member, inner);\n\n\t\t\t\t\t\t\t\t\t\twriter.AppendLineIndented(\");\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if (member.Objects.Count == 1)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar childType = GetType(member.Objects[0].Type).GetFullyQualifiedTypeExcludingGlobal();\n\t\t\t\t\t\t\t\t\tthrow new XamlGenerationException($\"Cannot assign child of type '{childType}' to property of type '{propertyType.GetFullyQualifiedTypeExcludingGlobal()}'\", member.Objects[0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tthrow new XamlGenerationException($\"The property '{member.Member.Name}' of type '{propertyType}' does not support adding multiple objects\", member);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// GenerateWarning(writer, $\"Unknown type {objectDefinition.Type} for property {member.Member.DeclaringType}\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar isMemberInsideResourceDictionary = IsMemberInsideResourceDictionary(objectDefinition);\n\t\t\t\t\t\t\tvar value = member.Value?.ToString();\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tmember.Member.Name == \"Name\"\n\t\t\t\t\t\t\t\t&& member.Member.PreferredXamlNamespace == XamlConstants.XamlXmlNamespace\n\t\t\t\t\t\t\t\t&& !isMemberInsideResourceDictionary.isInside\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t{","sourceCodeStart":3443,"sourceCodeEnd":3479,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs#L3443-L3479","documentation":"Companion to 310 in the same branch: thrown when a property is single-valued (not a collection, no Add support) and the XAML provides more than one object inside it. The property type cannot accept multiple objects, so generation aborts at line 3461. This is the explicit-property-element version of the 'multiple children on a scalar' problem (cf. 305 which is the implicit-content version).","triggerScenarios":"Writing <MyControl.Title><x/><y/></MyControl.Title> where Title is a string/object (single); nesting two or more elements inside any property-element whose property is not a collection.","commonSituations":"Assuming a property is a collection when it is scalar; copy-pasting multiple setters into a single Value; porting XAML where a property's multiplicity differs.","solutions":["Reduce to a single object inside the property-element tag.","If multiple values are needed, confirm the property is collection-typed; if not, choose the correct collection property or wrap appropriately.","Move extra objects to a sibling property-element that accepts them."],"exampleFix":"<!-- before -->\n<Button>\n  <Button.Content>\n    <TextBlock Text=\"A\"/>\n    <TextBlock Text=\"B\"/>\n  </Button.Content>\n</Button>\n\n<!-- after -->\n<Button>\n  <Button.Content>\n    <StackPanel>\n      <TextBlock Text=\"A\"/>\n      <TextBlock Text=\"B\"/>\n    </StackPanel>\n  </Button.Content>\n</Button>","handlingStrategy":"validation","validationCode":"# Structural lint: property-element tags with >1 element child where the property is scalar\nGet-ChildItem -Recurse -Filter *.xaml | ForEach-Object {\n  $x = [xml](Get-Content $_.FullName)\n  $x.SelectNodes('//*[contains(local-name(),\".\")]') | ForEach-Object {\n    $kids = $_.ChildNodes | Where-Object { $_.NodeType -eq 'Element' }\n    if ($kids.Count -gt 1) { Write-Warning \"$($_.LocalName) property-element has $($kids.Count) children\" }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat scalar properties as accepting exactly one value.","If you need many items, confirm the property is a collection; otherwise wrap in a container."],"tags":["xaml","property-assignment","collection","build"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}