{"record":{"id":"cda2cb2e7a9eefd7","repo":"AvaloniaUI/Avalonia","slug":"property-property-name-not-registered-on-o-ge","errorCode":null,"errorMessage":"Property '{property.Name} not registered on '{o.GetType()}","messagePattern":"Property '(.+?) not registered on '(.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/AvaloniaPropertyRegistry.cs","lineNumber":266,"sourceCode":"        /// <summary>\n        /// Gets a direct property as registered on an object.\n        /// </summary>\n        /// <param name=\"o\">The object.</param>\n        /// <param name=\"property\">The direct property.</param>\n        /// <returns>\n        /// The registered.\n        /// </returns>\n        public DirectPropertyBase<T> GetRegisteredDirect<T>(\n            AvaloniaObject o,\n            DirectPropertyBase<T> property)\n        {\n            return (DirectPropertyBase<T>)GetRegisteredDirectUntyped(o, property);\n        }\n\n        internal AvaloniaProperty GetRegisteredDirectUntyped(AvaloniaObject o, AvaloniaProperty property)\n        {\n            return FindRegisteredDirectUntyped(o, property) ??\n                   throw new ArgumentException($\"Property '{property.Name} not registered on '{o.GetType()}\");\n        }\n\n        /// <summary>\n        /// Finds a registered property on a type by name.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <param name=\"name\">The property name.</param>\n        /// <returns>\n        /// The registered property or null if no matching property found.\n        /// </returns>\n        /// <exception cref=\"InvalidOperationException\">\n        /// The property name contains a '.'.\n        /// </exception>\n        public AvaloniaProperty? FindRegistered(Type type, string name)\n        {\n            _ = type ?? throw new ArgumentNullException(nameof(type));\n            _ = name ?? throw new ArgumentNullException(nameof(name));\n","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/AvaloniaPropertyRegistry.cs#L248-L284","documentation":"Thrown by AvaloniaPropertyRegistry.GetRegisteredDirectUntyped when FindRegisteredDirectUntyped returns null, meaning the supplied direct property is not registered on the target object's type (or any of its base types). The registry walks the type hierarchy for direct properties and this one was not found.","triggerScenarios":"Passing a DirectPropertyBase<T> to GetRegisteredDirect(o, property) where property is not registered on o's type; using a direct property defined on a different control type; accessing a direct property before its owning type's static constructor has registered it.","commonSituations":"Mixing up direct property definitions between unrelated control types; referencing a base-class direct property on a derived instance that re-registered it differently; type-reloading scenarios where UnregisterByModule removed the property.","solutions":["Verify the direct property is registered on the exact type of the object via AvaloniaPropertyRegistry.Instance.IsRegistered(o, property) before calling GetRegisteredDirect.","Ensure the type that declares the direct property (via AvaloniaProperty.RegisterDirect) is the same type or a base of o.GetType().","Call the type-safe FindRegisteredDirect<T> variant which returns null instead of throwing, and handle the null case.","Confirm no UnregisterByModule call removed the property for the relevant type."],"exampleFix":"// before\nvar reg = registry.GetRegisteredDirect(control, MyControl.FooProperty);\n\n// after\nif (registry.IsRegistered(control, MyControl.FooProperty)) {\n    var reg = registry.GetRegisteredDirect(control, MyControl.FooProperty);\n}","handlingStrategy":"validation","validationCode":"if (!AvaloniaPropertyRegistry.Instance.IsRegistered(o, property)) { /* not registered; handle gracefully */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call IsRegistered(o, property) before GetRegisteredDirect.","Prefer the type-safe FindRegisteredDirect<T> that returns null instead of throwing.","Confirm the declaring type is in the object's hierarchy."],"tags":["avalonia","property-system","registration","direct-property"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}