{"record":{"id":"4247fc3869f1698f","repo":"unoplatform/uno","slug":"current-operation-is-invalid-for-unknown-member","errorCode":null,"errorMessage":"Current operation is invalid for unknown member.","messagePattern":"Current operation is invalid for unknown member\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml.Schema/XamlMemberInvoker.cs","lineNumber":61,"sourceCode":"\t\t\tif (member == null)\n\t\t\t\tthrow new ArgumentNullException (\"member\");\n\t\t\tthis.member = member;\n\t\t}\n\n\t\tXamlMember member;\n\n\t\tpublic MethodInfo UnderlyingGetter {\n\t\t\tget { return member != null ? member.UnderlyingGetter : null; }\n\t\t}\n\n\t\tpublic MethodInfo UnderlyingSetter {\n\t\t\tget { return member != null ? member.UnderlyingSetter : null; }\n\t\t}\n\n\t\tvoid ThrowIfUnknown ()\n\t\t{\n\t\t\tif (member == null)\n\t\t\t\tthrow new NotSupportedException (\"Current operation is invalid for unknown member.\");\n\t\t}\n\n\t\tpublic virtual object GetValue (object instance)\n\t\t{\n\t\t\tThrowIfUnknown ();\n\t\t\tif (instance == null)\n\t\t\t\tthrow new ArgumentNullException (\"instance\");\n\t\t\tif (member is XamlDirective)\n\t\t\t\tthrow new NotSupportedException (String.Format (CultureInfo.InvariantCulture, \"not supported operation on directive member {0}\", member));\n\t\t\tif (UnderlyingGetter == null)\n\t\t\t\tthrow new NotSupportedException (String.Format (CultureInfo.InvariantCulture, \"Attempt to get value from write-only property or event {0}\", member));\n\t\t\treturn UnderlyingGetter.Invoke (instance, Array.Empty<object>());\n\t\t}\n\t\tpublic virtual void SetValue (object instance, object value)\n\t\t{\n\t\t\tThrowIfUnknown ();\n\t\t\tif (instance == null)\n\t\t\t\tthrow new ArgumentNullException (\"instance\");","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml.Schema/XamlMemberInvoker.cs#L43-L79","documentation":"Thrown by XamlMemberInvoker.ThrowIfUnknown when an operation (GetValue/SetValue) is attempted on an invoker whose member field is null — i.e. the UnknownInvoker singleton or a default-constructed invoker. Unknown members have no backing CLR member to get or set, so the operation is meaningless.","triggerScenarios":"Calling GetValue or SetValue on XamlMemberInvoker.UnknownInvoker, or on an invoker created via the protected parameterless constructor. Triggered when a XamlMember was unknown and its Invoker defaulted to UnknownInvoker.","commonSituations":"XAML containing members that did not resolve against the schema context (typo, missing reference, attached property not registered); generic XAML processors that blindly invoke every member.","solutions":["Check member.IsUnknown (or invoker == XamlMemberInvoker.UnknownInvoker) before calling GetValue/SetValue and skip or log unknown members.","Fix the underlying resolution: declare the member, register the attached property, or correct the XAML namespace.","Use a custom XamlMemberInvoker subclass that supplies a sensible behavior for unknown members."],"exampleFix":"// before\ninvoker.SetValue(instance, value); // throws if unknown\n\n// after\nif (member.IsUnknown)\n    logger.LogWarning($\"Skipping unknown member {member}\");\nelse\n    invoker.SetValue(instance, value);","handlingStrategy":"type-guard","validationCode":"if (member.IsUnknown || invoker == XamlMemberInvoker.UnknownInvoker)\n{\n    logger.LogWarning($\"Skipping unknown member {member}\");\n    return;\n}\ninvoker.SetValue(instance, value);","typeGuard":"static bool IsKnownMember(XamlMember m) => m != null && !m.IsUnknown;","tryCatchPattern":null,"preventionTips":["Always check member.IsUnknown before invoking get/set.","Resolve unknown members by fixing the schema context (namespace, attached-property registration).","Log unknown members during XAML load to catch resolution failures early."],"tags":["xaml","schema","member-invoker","unknown-member","uno"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}