{"record":{"id":"629fb699bcc2d09e","repo":"dotnet/wpf","slug":"notimplementedexception-wpfxamltype","errorCode":null,"errorMessage":"NotImplementedException","messagePattern":"NotImplementedException","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfXamlType.cs","lineNumber":426,"sourceCode":"                    memberFromBase.Invoker.UnderlyingSetter,\n                    SchemaContext, UseV3Rules);\n            }\n            return null;\n        }\n\n        private XamlMember GetRegularDependencyProperty(string name, DependencyProperty property, bool skipReadOnlyCheck)\n        {\n            XamlMember memberFromBase = base.LookupMember(name, skipReadOnlyCheck);\n            if (memberFromBase != null)\n            {\n                PropertyInfo propertyInfo = memberFromBase.UnderlyingMember as PropertyInfo;\n                if (propertyInfo != null)\n                {\n                    return new WpfXamlMember(property, propertyInfo, SchemaContext, UseV3Rules);\n                }\n                else\n                {\n                    throw new NotImplementedException();\n                }\n            }\n\n            return null;\n        }\n\n        // First try looking at the cache\n        // Then look to see if we have a known property on the type\n        private static XamlMember FindKnownMember(WpfXamlType wpfXamlType, string name, bool isAttachable)\n        {\n            XamlMember xamlMember = null;\n\n            // Look in the cache first\n            if (!isAttachable || wpfXamlType.IsBamlScenario)\n            {\n                if (wpfXamlType._members != null && wpfXamlType.Members.TryGetValue(name, out xamlMember))\n                {\n                    return xamlMember;","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfXamlType.cs#L408-L444","documentation":"GetRegularDependencyProperty wraps a DependencyProperty-backed CLR property into a WpfXamlMember, but only when the base lookup returned a PropertyInfo. If the underlying member is not a PropertyInfo, the code has hit an unhandled case and throws a bare NotImplementedException — the internal assumption that DP-backed members are always properties was violated.","triggerScenarios":"LookupMember on a WpfXamlType resolves a DependencyProperty-backed name whose base XamlMember.UnderlyingMember is not a PropertyInfo (e.g. an event, a method, or a custom XamlMember returned by an overridden base lookup).","commonSituations":"Custom XAML schema extensions or third-party XamlType subclasses returning non-property underlying members for names that clash with DependencyProperty fields; dynamic-type scenarios where the member table contains unexpected member kinds.","solutions":["Ensure the type's DependencyProperty-backed members are exposed as real CLR wrapper properties.","Check for a name clash: an event or method sharing the name of the DP wrapper is shadowing the property — rename it.","If overriding LookupMember in a custom XamlType, return members whose UnderlyingMember is a PropertyInfo for DP-backed names.","Catch NotImplementedException in tooling paths and fall back to base XamlType member resolution."],"exampleFix":"// before\npublic event EventHandler Foo; // alongside public static readonly DependencyProperty FooProperty\n// after\npublic static readonly DependencyProperty FooProperty = DependencyProperty.Register(nameof(Foo), ...);\npublic object Foo { get => GetValue(FooProperty); set => SetValue(FooProperty, value); } // CLR wrapper is a PropertyInfo","handlingStrategy":"fallback","validationCode":"var m = baseType.GetMember(name).FirstOrDefault(x => x is PropertyInfo);\nif (m == null) throw new InvalidOperationException($\"'{name}' on {baseType} is not a property; DP-backed members must be CLR properties.\");","typeGuard":"bool IsPropertyBacked(System.Reflection.MemberInfo mi) => mi is PropertyInfo;","tryCatchPattern":"try { member = wpfType.GetMember(name); }\ncatch (NotImplementedException)\n{\n    // fall back to base XamlType.LookupMember or reflection-based resolution\n}","preventionTips":["Always expose DP-backed members via CLR wrapper properties.","Avoid name collisions between events/methods and DependencyProperty fields.","When subclassing XamlType, return PropertyInfo-backed members for DP names."],"tags":["wpf","xaml","dependency-property","not-implemented"],"backgroundTag":"method-not-implemented","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}