dotnet/wpf · error · InvalidOperationException
SR.Format(SR.PropertyPathNoProperty, ownerType.Name…
Error message
SR.Format(SR.PropertyPathNoProperty, ownerType.Name, propertyName)
What it means
ResolvePropertyName throws this InvalidOperationException when the owner type was resolved but the requested property name does not exist on that type. WPF searched CLR properties, dependency properties, and indexed-property accessors (including IDynamicMetaObjectProvider dynamic accessors) and found none matching propertyName, so the path is unresolvable.
Solutions
- Correct the property-name spelling in the path string to match the actual property on ownerType
- Verify the property exists and is public on the type: check ownerType.GetProperty(propertyName) returns non-null
- If the property lives on a derived type, ensure the bound item's runtime type exposes it, or cast/adjust the path
- For dynamic objects, confirm the member name is provided by the TryGetMember implementation
Example fix
// before
var path = new PropertyPath("(local:Customer.FirstNmae)", ctx);
// after (typo fixed)
var path = new PropertyPath("(local:Customer.FirstName)", ctx); Defensive patterns
Strategy: validation
Validate before calling
bool propertyExists = typeof(Customer).GetProperty("FirstName",
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) != null; Type guard
bool HasPublicProperty(object o, string name) =>
o?.GetType().GetProperty(name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) != null; Try / catch
try { var path = new PropertyPath("(local:Customer.FirstName)", ctx); }
catch (InvalidOperationException ex) when (ex.Message.Contains("has no property")) { /* correct the property name */ } Prevention
- Verify property names against the model class when writing binding paths
- Keep INotifyPropertyChanged notification names identical to CLR property names
- Run binding-path unit tests after any model refactor
When it happens
Trigger: Binding path like '(local:Customer.FirstNmae)' where the property is misspelled; the property was removed/renamed on the owner type; the property is private/static so no public accessor is found; a dynamic object lacking the requested member.
Common situations: Refactorings renaming model properties without updating XAML binding paths; case-sensitivity mismatches; binding to properties that only exist on a derived type while the bound item is the base type; INotifyPropertyChanged property names drifting from actual CLR property names.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- SR.Format(SR.ParserPrefixNSProperty, nsPrefix, name)
- SR.Format(SR.PathParameterIsNull, index)
- SR.Format(SR.PathParametersIndexOutOfRange, index…
- SR.Format(SR.PropertyPathIndexWrongType…
- SR.Format(SR.PropertyPathInvalidAccessor, (accessor !=…
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/b699123c8c2581b4.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/PropertyPath.cs:637
{
accessor = TypeDescriptor.GetProperties(item)[propertyName];
}
// 5. PropertyInfo.
if (accessor == null)
{
accessor = GetPropertyHelper(ownerType, propertyName);
}
// 6. IDynamicMetaObjectProvider
// This supports the DLR's dynamic objects
if (accessor == null && SystemCoreHelper.IsIDynamicMetaObjectProvider(item))
{
accessor = SystemCoreHelper.NewDynamicPropertyAccessor(item.GetType(), propertyName);
}
if (accessor == null && throwOnError)
throw new InvalidOperationException(SR.Format(SR.PropertyPathNoProperty, ownerType.Name, propertyName));
return accessor;
}
return null;
}
private PropertyInfo GetPropertyHelper(Type ownerType, string propertyName)
{
PropertyInfo result = null;
bool enumerateBaseClasses = false;
bool returnIndexerProperty = false;
try
{
result = ownerType.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
}
catch (AmbiguousMatchException)View on GitHub (pinned to 81131a70a4)