unoplatform/uno · error · XamlGenerationException

The TargetProperty property cannot be empty

Error message

The TargetProperty property cannot be empty

What it means

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.

Source

Thrown at src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs:3583

							}
							else if (
								member.Member.Name == "TargetName" &&
								!IsAttachedProperty(member) &&
								(member.Member.DeclaringType?.Name.EndsWith("ThemeAnimation", StringComparison.Ordinal) ?? false)
							)
							{
								// Those special animations (xxxThemeAnimation) needs to resolve their target at runtime.
								writer.AppendLineInvariantIndented(@"NameScope.SetNameScope({0}, __nameScope);", writer.AppliedParameterName);
							}
							else if (
								member.Member.Name == "TargetProperty" &&
								IsAttachedProperty(member) &&
								member.Member.DeclaringType?.Name == "Storyboard"
							)
							{
								if (member.Value == null)
								{
									throw new XamlGenerationException("The TargetProperty property cannot be empty", member);
								}

								var memberGlobalizedType = FindType(member.Member.DeclaringType)?.GetFullyQualifiedTypeIncludingGlobal() ?? GetGlobalizedTypeName(member.Member.DeclaringType.Name);
								writer.AppendLineInvariantIndented(@"{0}.SetTargetProperty({2}, ""{1}"");",
									memberGlobalizedType,
									this.RewriteAttachedPropertyPath(member.Value.ToString() ?? ""),
									writer.AppliedParameterName);
							}
							else if (
								member.Member.DeclaringType?.Name == "RelativePanel" &&
								IsAttachedProperty(member) &&
								IsRelativePanelSiblingProperty(member.Member.Name)
							)
							{
								var memberGlobalizedType = FindType(member.Member.DeclaringType)?.GetFullyQualifiedTypeIncludingGlobal() ?? GetGlobalizedTypeName(member.Member.DeclaringType.Name);
								writer.AppendLineInvariantIndented(@"{0}.Set{1}({2}, _{3}Subject);",
									memberGlobalizedType,
									member.Member.Name,

View on GitHub (pinned to 0418340488)

Solutions

  1. Set Storyboard.TargetProperty to a valid property path, e.g. "(UIElement.Opacity)" or "Opacity".
  2. Confirm the property path syntax matches WinUI (attached properties use parentheses).
  3. Verify the target element actually exposes the named property.

Example fix

<!-- before -->
<DoubleAnimation Storyboard.TargetName="r" Storyboard.TargetProperty=""/>

<!-- after -->
<DoubleAnimation Storyboard.TargetName="r" Storyboard.TargetProperty="(UIElement.Opacity)"/>
Defensive patterns

Strategy: validation

Validate before calling

# Flag animations with empty Storyboard.TargetProperty
Get-ChildItem -Recurse -Filter *.xaml | ForEach-Object {
  Select-String -Path $_.FullName -Pattern 'Storyboard\.TargetProperty="\s*"' |
    ForEach-Object { Write-Warning "$($_.Filename):$($_.LineNumber): empty Storyboard.TargetProperty" }
}

Prevention

When it happens

Trigger: An animation with Storyboard.TargetProperty="" (empty); a markup extension that resolves TargetProperty to null.

Common situations: Leaving TargetProperty blank while authoring an animation; copy-paste dropping the property path; misspelling the property so a markup extension yields nothing.

Related errors


AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13). Data as JSON: /api/errors/0c1100e3c6945cf1. Report an issue: GitHub.