{"record":{"id":"056c414727a0a7d9","repo":"unoplatform/uno","slug":"instance","errorCode":null,"errorMessage":"instance","messagePattern":"instance","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml.Schema/XamlMemberInvoker.cs","lineNumber":68,"sourceCode":"\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\");\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 (UnderlyingSetter == null)\n\t\t\t\tthrow new NotSupportedException (String.Format (CultureInfo.InvariantCulture, \"Attempt to set value from read-only property {0}\", member));\n\t\t\tif (member.IsAttachable)\n\t\t\t\tUnderlyingSetter.Invoke (null, new object [] {instance, value});\n\t\t\telse","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml.Schema/XamlMemberInvoker.cs#L50-L86","documentation":"Thrown by XamlMemberInvoker.GetValue/SetValue when the instance argument is null (after the unknown-member check passes). The invoker must reflect over a concrete target object to read or write the member, so a null instance is invalid.","triggerScenarios":"Calling invoker.GetValue(null) or invoker.SetValue(null, value) where the owning object was not supplied, e.g. processing an attached property against a null parent.","commonSituations":"XAML readers that emit SetValue calls before the parent object is constructed; tree-walking code that hits a null node; deferred loading where the instance is not yet realized.","solutions":["Ensure the owning instance is non-null before invoking, e.g. skip or queue the operation until the instance is realized.","For attached members, confirm the target element was created in the visual/logical tree.","Add a null guard at the call site to fail with a domain-specific message."],"exampleFix":"// before\ninvoker.SetValue(target, value); // throws if target null\n\n// after\nif (target != null)\n    invoker.SetValue(target, value);\nelse\n    _pendingSets.Enqueue((invoker, value));","handlingStrategy":"validation","validationCode":"if (instance == null)\n    throw new InvalidOperationException(\"owning instance not realized\");\ninvoker.SetValue(instance, value);","typeGuard":"static bool HasInstance(object o) => o != null;","tryCatchPattern":null,"preventionTips":["Ensure parent instances are constructed before issuing SetValue/GetValue.","For attached members, confirm the target element exists in the tree.","Queue operations whose target is not yet realized rather than passing null."],"tags":["xaml","schema","member-invoker","argument-null","uno"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}