dotnet/wpf · error
SR.Format(SR.ParserCannotConvertPropertyValue, "Property"…
Error message
SR.Format(SR.ParserCannotConvertPropertyValue, "Property", typeof(DependencyProperty).FullName)
What it means
DependencyPropertyConverter.ResolveProperty parses a string like 'OwnerType.Property' into a DependencyProperty. The else-branch throws NotSupportedException when the value has no recognized separator form — i.e. the string is neither owner-qualified nor resolvable through the parsing path, so no 'Property' portion could be extracted.
Solutions
- Qualify the property with its owner type: Property="Control.Background"
- Use the x:Static or attached-property syntax appropriate for the property
- Check for typos such as a missing '.' between type and property name
- If the type must come from TargetName/sourceName, ensure the template context provides it
Example fix
// before <Setter Property="Background" Value="Red"/>// after <Setter Property="Control.Background" Value="Red"/>
Defensive patterns
Strategy: validation
Validate before calling
static bool IsQualifiedProperty(string v) => v != null && v.Contains('.');
if (!IsQualifiedProperty(propertyString)) throw new ArgumentException("Use 'Type.Property' form for Setter/Trigger Property"); Type guard
static bool IsValidDpString(string? v) => !string.IsNullOrEmpty(v) && v.Split('.').Length == 2; Try / catch
try { var dp = (DependencyProperty)converter.ConvertFrom(ctx, culture, value); } catch (NotSupportedException ex) when (ex.Message.Contains("DependencyProperty")) { throw new XamlParseException($"Property '{value}' must be owner-qualified, e.g. 'Control.{value}'"); } Prevention
- Always write Setter/Trigger Property values as Type.PropertyName
- Lint XAML for unqualified Property attributes
- Check TargetName/TargetType support when relying on template context
When it happens
Trigger: Setter Property or Trigger Property value given as a bare or malformed string that lacks the expected 'Type.Property' / 'prefix:Type.Property' format, so the value does not contain a parsable property reference.
Common situations: XAML like <Setter Property="Background"/> where the value lacks a type qualifier and no owning type can be determined; copy-pasted WPF property strings into a context expecting qualified names; typos dropping the '.Property' part.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- NotImplementedException
- SR.Format(SR.InvalidPropertyValue, value…
- SR.MarkupExtensionDynamicOrBindingOnClrProp
- ' '.' ' is a property without a getter and is not a valid…
- ' '.' ' is a property without a getter and is not a valid…
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/9cbaeae6c620e91c.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/DependencyPropertyConverter.cs:156
int lastIndex = value.LastIndexOf('.');
string typeName = value.Substring(0, lastIndex);
property = value.Substring(lastIndex + 1);
IXamlTypeResolver resolver = serviceProvider.GetService(typeof(IXamlTypeResolver))
as IXamlTypeResolver;
type = resolver.Resolve(typeName);
}
else
{
// Only have the property name
// Strip prefixes if there are any, v3 essentially discards the prefix in this case
int lastIndex = value.LastIndexOf(':');
property = value.Substring(lastIndex + 1);
}
}
else
{
throw new NotSupportedException(SR.Format(SR.ParserCannotConvertPropertyValue, "Property", typeof(DependencyProperty).FullName));
}
// We got additional info from either Trigger.SourceName or Setter.TargetName
if (type == null && targetName != null)
{
IAmbientProvider ambientProvider = serviceProvider.GetService(typeof(IAmbientProvider))
as System.Xaml.IAmbientProvider;
XamlSchemaContext schemaContext = (serviceProvider.GetService(typeof(IXamlSchemaContextProvider))
as IXamlSchemaContextProvider).SchemaContext;
type = GetTypeFromName(schemaContext,
ambientProvider, targetName);
}
// Still don't have a Type so we need to loop up the chain and grab either Style.TargetType,
// DataTemplate.DataType, or ControlTemplate.TargetType
if (type == null)
{View on GitHub (pinned to 81131a70a4)