dotnet/wpf · error · XamlSchemaException
' '.' ' is a property without a getter and is not a valid…
Error message
'{0}'.'{1}' is a property without a getter and is not a valid XAML property. What it means
System.Xaml throws this XamlSchemaException when an attachable member is registered that has neither a getter nor a setter method. XAML properties must be readable to be valid; a member with no accessors cannot participate in XAML loading or type reflection, so the schema layer rejects it at construction time.
Solutions
- Define a public static Get<Name>(target) method on the declaring type (or pass a valid MethodInfo as getter).
- Ensure the Set<Name>(target, value) method exists and is resolvable so the constructor receives a non-null setter.
- Fix the type resolution/naming convention in the code that locates the accessor methods before constructing ClrAttachedProperty.
Example fix
// before: no accessors found
class MyExt { /* no GetGlow / SetGlow */ }
// after
class MyExt {
public static double GetGlow(DependencyObject o) => ...;
public static void SetGlow(DependencyObject o, double v) { ... }
} Defensive patterns
Strategy: validation
Validate before calling
// before registering an attachable property
var getter = type.GetMethod("Get" + name, BindingFlags.Public|BindingFlags.Static, null, new[]{ targetType }, null);
var setter = type.GetMethod("Set" + name, BindingFlags.Public|BindingFlags.Static);
if (getter == null && setter == null)
throw new InvalidOperationException($"{type.Name}.{name} needs a Get{Name} or Set{Name} static method"); Type guard
bool HasAccessor(EventInfo e) => e.GetAddMethod(true) != null; // for attachable props: getter != null || setter != null
Try / catch
try { schema.RegisterAttachableProperty(name, type); }
catch (XamlSchemaException ex) { log($"Invalid attachable property: {ex.Message}"); } Prevention
- Always pair attachable properties with Get/Set static methods following the WPF naming convention.
- Unit-test XAML schema registration for every attachable member.
- Run reflection checks over the assembly before loading XAML.
When it happens
Trigger: Calling the internal/public ClrAttachedProperty constructor (via reflection-based schema provider) with getter == null and setter == null for an attachable property of declaringType.
Common situations: Custom XAML schema/context implementations registering attachable properties discovered by convention, where naming-based reflection failed to bind either an Get<Name> or Set<Name> static method; refactoring renamed one accessor so neither resolved.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- ' '.' ' is a property without a getter and is not a valid…
- ' '.' ' is a property without a getter and is not a valid…
- Attached property setter and attached event adder methods…
- Can't Assign to Known Member attributes
- SR.Format(SR.MarkupExtensionBadStatic, typeNameForError is…
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/858b614dde20b74a.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/ClrAttachableProperty.cs:37
namespace MS.Internal.Xaml.Schema
#else
namespace System.Xaml.Schema
#endif
{
[DebuggerDisplay("{Name}")]
class ClrAttachedProperty : ClrProperty
{
public readonly MethodInfo ClrBindingGetterMethodInfo;
public readonly MethodInfo ClrBindingSetterMethodInfo;
private Type _systemTypeOfProperty = null;
internal ClrAttachedProperty(string name, MethodInfo getter, MethodInfo setter, XamlType declaringType)
: base(name, declaringType)
{
Debug.Assert(getter != null || setter != null);
if (getter == null && setter == null)
{
throw new XamlSchemaException(SR.Format(SR.SetOnlyProperty, declaringType.Name, name));
}
_isPublic = (getter != null) ? getter.IsPublic : setter.IsPublic;
_isReadOnly = (setter == null);
_isStatic = false;
_isAttachable = true;
_isEvent = false;
ClrBindingGetterMethodInfo = getter;
ClrBindingSetterMethodInfo = setter;
}
protected override Type LookupSystemTypeOfProperty()
{
if (_systemTypeOfProperty == null)
{
_systemTypeOfProperty = PrivateLookupSystemTypeOfProperty;
}View on GitHub (pinned to 81131a70a4)