{"record":{"id":"bed2194fee93f229","repo":"unoplatform/uno","slug":"property","errorCode":null,"errorMessage":"property","messagePattern":"property","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml/XamlWriterInternalBase.cs","lineNumber":185,"sourceCode":"\t\t\tmanager.StartObject ();\n\n\t\t\tvar cstate = new ObjectState () {Type = xamlType};\n\t\t\tobject_states.Push (cstate);\n\n\t\t\tOnWriteStartObject ();\n\t\t}\n\t\t\n\t\tpublic void WriteValue (object value)\n\t\t{\n\t\t\tmanager.Value ();\n\n\t\t\tOnWriteValue (value);\n\t\t}\n\t\t\n\t\tpublic void WriteStartMember (XamlMember property)\n\t\t{\n\t\t\tif (property == null)\n\t\t\t\tthrow new ArgumentNullException (\"property\");\n\n\t\t\tmanager.StartMember ();\n\t\t\tif (property == XamlLanguage.PositionalParameters)\n\t\t\t\t// this is an exception that indicates the state manager to accept more than values within this member.\n\t\t\t\tmanager.AcceptMultipleValues = true;\n\n\t\t\tvar state = object_states.Peek ();\n\t\t\tvar wpl = state.WrittenProperties;\n\t\t\tif (wpl.Any (wp => wp.Member == property))\n\t\t\t\tthrow new XamlDuplicateMemberException (String.Format (CultureInfo.InvariantCulture, \"Property '{0}' is already set to this '{1}' object\", property, object_states.Peek ().Type));\n\t\t\twpl.Add (new MemberAndValue (property));\n\t\t\tif (property == XamlLanguage.PositionalParameters)\n\t\t\t\tstate.PositionalParameterIndex = 0;\n\n\t\t\tOnWriteStartMember (property);\n\t\t}\n\t\t\n\t\tpublic void WriteEndObject ()","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml/XamlWriterInternalBase.cs#L167-L203","documentation":"XamlWriterInternalBase.WriteStartMember throws ArgumentNullException('property') when a null XamlMember is written. The member is added to the current object's written-properties list and compared against XamlLanguage.PositionalParameters, so a null member corrupts both state tracking and duplicate detection.","triggerScenarios":"Forwarding a StartMember node from a reader whose Member property is null (reader not positioned on a member, or member resolution failed), or programmatically writing a member before it was resolved.","commonSituations":"Custom XamlReader returning null Member on StartMember nodes; member-resolution code that returns null for unknown properties and the pipeline forwards it anyway; tests of the guard.","solutions":["Resolve the XamlMember before writing it; if resolution fails, report an error rather than writing null.","In custom readers, ensure Member is non-null when NodeType == StartMember.","Skip unknown members if your pipeline policy allows it, instead of writing null."],"exampleFix":"// before\nif (reader.NodeType == XamlNodeType.StartMember)\n    writer.WriteStartMember(reader.Member);\n\n// after\nif (reader.NodeType == XamlNodeType.StartMember && reader.Member != null)\n    writer.WriteStartMember(reader.Member);","handlingStrategy":"type-guard","validationCode":"if (reader.NodeType == XamlNodeType.StartMember && reader.Member != null)\n    writer.WriteStartMember(reader.Member);","typeGuard":"static bool CanWriteStartMember(XamlReader r) => r.NodeType == XamlNodeType.StartMember && r.Member is not null;","tryCatchPattern":null,"preventionTips":["Resolve the XamlMember before writing; report resolution failures explicitly.","Ensure custom readers return non-null Member on StartMember nodes."],"tags":["xaml","argument-null","xamlwriter","xamlmember"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}