{"record":{"id":"a584ea2d6ed5604d","repo":"unoplatform/uno","slug":"either-property-getter-or-setter-must-be-non-null","errorCode":null,"errorMessage":"Either property getter or setter must be non-null.","messagePattern":"Either property getter or setter must be non-null\\.","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml/XamlMember.cs","lineNumber":105,"sourceCode":"\t\t\tDeclaringType = schemaContext.GetXamlType (adder.DeclaringType);\n\t\t\ttarget_type = schemaContext.GetXamlType (typeof (object));\n\t\t\tUnderlyingSetter = adder;\n\t\t\tis_event = true;\n\t\t\tis_attachable = true;\n\t\t}\n\n\t\tpublic XamlMember (string attachablePropertyName, MethodInfo getter, MethodInfo setter, XamlSchemaContext schemaContext)\n\t\t\t: this (attachablePropertyName, getter, setter, schemaContext, null)\n\t\t{\n\t\t}\n\n\t\tpublic XamlMember (string attachablePropertyName, MethodInfo getter, MethodInfo setter, XamlSchemaContext schemaContext, XamlMemberInvoker invoker)\n\t\t\t: this (schemaContext, invoker)\n\t\t{\n\t\t\tif (attachablePropertyName == null)\n\t\t\t\tthrow new ArgumentNullException (\"attachablePropertyName\");\n\t\t\tif (getter == null && setter == null)\n\t\t\t\tthrow new ArgumentNullException (\"getter\", \"Either property getter or setter must be non-null.\");\n\t\t\tName = attachablePropertyName;\n\t\t\tVerifyGetter (getter);\n\t\t\tVerifyAdderSetter (setter);\n\t\t\tunderlying_member = getter ?? setter;\n\t\t\tDeclaringType = schemaContext.GetXamlType (underlying_member.DeclaringType);\n\t\t\ttarget_type = schemaContext.GetXamlType (typeof (object));\n\t\t\tUnderlyingGetter = getter;\n\t\t\tUnderlyingSetter = setter;\n\t\t\tis_attachable = true;\n\t\t}\n\n\t\tpublic XamlMember (string name, XamlType declaringType, bool isAttachable)\n\t\t{\n\t\t\tif (name == null)\n\t\t\t\tthrow new ArgumentNullException (\"name\");\n\t\t\tif (declaringType == null)\n\t\t\t\tthrow new ArgumentNullException (\"declaringType\");\n\t\t\tName = name;","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml/XamlMember.cs#L87-L123","documentation":"Thrown by the attachable-property XamlMember constructor (string, MethodInfo, MethodInfo, ...) when both getter and setter MethodInfos are null. An attachable property is defined by its get/set accessors; providing neither makes the member meaningless and the library rejects it with an ArgumentNullException keyed on 'getter'.","triggerScenarios":"Constructing new XamlMember(\"MyProp\", null, null, schemaContext) — both accessor methods are null. Typically from reflection that resolves accessors by name and finds neither.","commonSituations":"Reflection-driven attachable member construction where the get/set method names were computed wrong (wrong naming convention, wrong binding flags). Schema-context code that tries to look up an attachable property that does not exist on the target type.","solutions":["Ensure at least one of getter or setter is a valid MethodInfo before constructing the XamlMember.","Fix the reflection lookup (method name patterns like Get<PropName>/Set<PropName>, binding flags) so it resolves the accessor.","Skip XamlMember construction entirely if neither accessor resolves — the property does not exist on the type."],"exampleFix":"// before\nvar getter = type.GetMethod(\"Get\" + propName, ...);\nvar setter = type.GetMethod(\"Set\" + propName, ...);\nvar member = new XamlMember(propName, getter, setter, sctx);\n// both null → throws\n\n// after\nvar getter = type.GetMethod(\"Get\" + propName, ...);\nvar setter = type.GetMethod(\"Set\" + propName, ...);\nif (getter == null && setter == null)\n    return null; // not an attachable property\nvar member = new XamlMember(propName, getter, setter, sctx);","handlingStrategy":"validation","validationCode":"if (getter == null && setter == null) return null;\nvar member = new XamlMember(propName, getter, setter, sctx);","typeGuard":"static bool HasAccessor(MethodInfo g, MethodInfo s) => g != null || s != null;","tryCatchPattern":"try { return new XamlMember(name, getter, setter, sctx); }\ncatch (ArgumentNullException) { return null; }","preventionTips":["Verify at least one accessor resolves before constructing an attachable XamlMember.","Use correct method-name patterns and binding flags in reflection."],"tags":["xaml","schema","argument-null","xaml-member","uno-xaml"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}