{"record":{"id":"e16a3ea65435012b","repo":"AvaloniaUI/Avalonia","slug":"unsupported-avaloniaproperty-type-e16a3e","errorCode":null,"errorMessage":"Unsupported AvaloniaProperty type.","messagePattern":"Unsupported AvaloniaProperty type\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/AvaloniaObjectExtensions.cs","lineNumber":202,"sourceCode":"        /// <param name=\"priority\">The priority of the binding.</param>\n        /// <returns>\n        /// A disposable which can be used to terminate the binding.\n        /// </returns>\n        public static IDisposable Bind<T>(\n            this AvaloniaObject target,\n            AvaloniaProperty<T> property,\n            IObservable<BindingValue<T>> source,\n            BindingPriority priority = BindingPriority.LocalValue)\n        {\n            target = target ?? throw new ArgumentNullException(nameof(target));\n            property = property ?? throw new ArgumentNullException(nameof(property));\n            source = source ?? throw new ArgumentNullException(nameof(source));\n\n            return property switch\n            {\n                StyledProperty<T> styled => target.Bind(styled, source, priority),\n                DirectPropertyBase<T> direct => target.Bind(direct, source),\n                _ => throw new NotSupportedException(\"Unsupported AvaloniaProperty type.\"),\n            };\n        }\n\n        /// <summary>\n        /// Binds an <see cref=\"AvaloniaProperty\"/> to an observable.\n        /// </summary>\n        /// <param name=\"target\">The object.</param>\n        /// <param name=\"property\">The property.</param>\n        /// <param name=\"source\">The observable.</param>\n        /// <param name=\"priority\">The priority of the binding.</param>\n        /// <returns>\n        /// A disposable which can be used to terminate the binding.\n        /// </returns>\n        public static IDisposable Bind<T>(\n            this AvaloniaObject target,\n            AvaloniaProperty<T> property,\n            IObservable<T> source,\n            BindingPriority priority = BindingPriority.LocalValue)","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/AvaloniaObjectExtensions.cs#L184-L220","documentation":"Thrown by AvaloniaObjectExtensions.Bind<T>(AvaloniaProperty<T>, IObservable<BindingValue<T>>) when the property is neither StyledProperty<T> nor DirectPropertyBase<T>. The extension dispatches on runtime type; an unrecognized AvaloniaProperty<T> subclass falls to the default arm.","triggerScenarios":"Passing a custom AvaloniaProperty<T> subclass, or an attached property not matching either branch, to the Bind overload taking BindingValue<T>.","commonSituations":"Generic/reflective binding helpers that resolve properties dynamically; libraries extending the property system.","solutions":["Bind using the concrete overload: target.Bind(StyledProperty<T>, source) or target.Bind(DirectPropertyBase<T>, source).","Ensure the property is registered as styled or direct.","Type-check before dispatching in generic helpers."],"exampleFix":"// before\ntarget.Bind(someProp, observable); // someProp is unknown kind\n\n// after\nswitch (someProp)\n{\n    case StyledProperty<T> s: target.Bind(s, observable); break;\n    case DirectPropertyBase<T> d: target.Bind(d, observable); break;\n}","handlingStrategy":"type-guard","validationCode":"switch (property)\n{\n    case StyledProperty<T> s: return target.Bind(s, source, priority);\n    case DirectPropertyBase<T> d: return target.Bind(d, source);\n    default: throw new NotSupportedException();\n}","typeGuard":"static bool IsBindable<T>(AvaloniaProperty<T> p) =>\n    p is StyledProperty<T> or DirectPropertyBase<T>;","tryCatchPattern":null,"preventionTips":["In generic helpers, dispatch on property runtime type.","Register custom properties as styled/direct."],"tags":["binding","extensions","property-system","not-supported"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}