{"record":{"id":"0c1100e3c6945cf1","repo":"unoplatform/uno","slug":"the-targetproperty-property-cannot-be-empty","errorCode":null,"errorMessage":"The TargetProperty property cannot be empty","messagePattern":"The TargetProperty property cannot be empty","errorType":"exception","errorClass":"XamlGenerationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs","lineNumber":3583,"sourceCode":"\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (\n\t\t\t\t\t\t\t\tmember.Member.Name == \"TargetName\" &&\n\t\t\t\t\t\t\t\t!IsAttachedProperty(member) &&\n\t\t\t\t\t\t\t\t(member.Member.DeclaringType?.Name.EndsWith(\"ThemeAnimation\", StringComparison.Ordinal) ?? false)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Those special animations (xxxThemeAnimation) needs to resolve their target at runtime.\n\t\t\t\t\t\t\t\twriter.AppendLineInvariantIndented(@\"NameScope.SetNameScope({0}, __nameScope);\", writer.AppliedParameterName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (\n\t\t\t\t\t\t\t\tmember.Member.Name == \"TargetProperty\" &&\n\t\t\t\t\t\t\t\tIsAttachedProperty(member) &&\n\t\t\t\t\t\t\t\tmember.Member.DeclaringType?.Name == \"Storyboard\"\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (member.Value == null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tthrow new XamlGenerationException(\"The TargetProperty property cannot be empty\", member);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar memberGlobalizedType = FindType(member.Member.DeclaringType)?.GetFullyQualifiedTypeIncludingGlobal() ?? GetGlobalizedTypeName(member.Member.DeclaringType.Name);\n\t\t\t\t\t\t\t\twriter.AppendLineInvariantIndented(@\"{0}.SetTargetProperty({2}, \"\"{1}\"\");\",\n\t\t\t\t\t\t\t\t\tmemberGlobalizedType,\n\t\t\t\t\t\t\t\t\tthis.RewriteAttachedPropertyPath(member.Value.ToString() ?? \"\"),\n\t\t\t\t\t\t\t\t\twriter.AppliedParameterName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (\n\t\t\t\t\t\t\t\tmember.Member.DeclaringType?.Name == \"RelativePanel\" &&\n\t\t\t\t\t\t\t\tIsAttachedProperty(member) &&\n\t\t\t\t\t\t\t\tIsRelativePanelSiblingProperty(member.Member.Name)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar memberGlobalizedType = FindType(member.Member.DeclaringType)?.GetFullyQualifiedTypeIncludingGlobal() ?? GetGlobalizedTypeName(member.Member.DeclaringType.Name);\n\t\t\t\t\t\t\t\twriter.AppendLineInvariantIndented(@\"{0}.Set{1}({2}, _{3}Subject);\",\n\t\t\t\t\t\t\t\t\tmemberGlobalizedType,\n\t\t\t\t\t\t\t\t\tmember.Member.Name,","sourceCodeStart":3565,"sourceCodeEnd":3601,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs#L3565-L3601","documentation":"Sibling of 313: thrown in the Storyboard.TargetProperty attached-property branch when member.Value is null. SetTargetProperty needs the property path string; an empty value cannot be emitted. Fires for animations whose TargetProperty attribute is blank.","triggerScenarios":"An animation with Storyboard.TargetProperty=\"\" (empty); a markup extension that resolves TargetProperty to null.","commonSituations":"Leaving TargetProperty blank while authoring an animation; copy-paste dropping the property path; misspelling the property so a markup extension yields nothing.","solutions":["Set Storyboard.TargetProperty to a valid property path, e.g. \"(UIElement.Opacity)\" or \"Opacity\".","Confirm the property path syntax matches WinUI (attached properties use parentheses).","Verify the target element actually exposes the named property."],"exampleFix":"<!-- before -->\n<DoubleAnimation Storyboard.TargetName=\"r\" Storyboard.TargetProperty=\"\"/>\n\n<!-- after -->\n<DoubleAnimation Storyboard.TargetName=\"r\" Storyboard.TargetProperty=\"(UIElement.Opacity)\"/>","handlingStrategy":"validation","validationCode":"# Flag animations with empty Storyboard.TargetProperty\nGet-ChildItem -Recurse -Filter *.xaml | ForEach-Object {\n  Select-String -Path $_.FullName -Pattern 'Storyboard\\.TargetProperty=\"\\s*\"' |\n    ForEach-Object { Write-Warning \"$($_.Filename):$($_.LineNumber): empty Storyboard.TargetProperty\" }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use valid property-path syntax (parentheses for attached properties).","Verify the target element exposes the property before referencing it."],"tags":["xaml","storyboard","animation","target-property","build"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}