{"record":{"id":"5ef3c9d62119bbd7","repo":"stride3d/stride","slug":"specialcollectionmember-can-not-be-null","errorCode":null,"errorMessage":"specialCollectionMember can not be null","messagePattern":"specialCollectionMember can not be null","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs","lineNumber":251,"sourceCode":"        /// Gets or sets the prefix used to serialize items for a non pure <see cref=\"System.Collections.IDictionary\" /> or\n        /// <see cref=\"System.Collections.ICollection\" />\n        /// . Default to \"~Items\", see remarks.\n        /// </summary>\n        /// <value>The prefix for items.</value>\n        /// <exception cref=\"System.ArgumentNullException\">value</exception>\n        /// <exception cref=\"System.ArgumentException\">Expecting length >= 2 and at least a special character '.', '~', '-' (not starting on first char for '-')</exception>\n        /// <remarks>A pure <see cref=\"System.Collections.IDictionary\" /> or <see cref=\"System.Collections.ICollection\" /> is a class that inherits from these types but are not adding any\n        /// public properties or fields. When these types are pure, they are respectively serialized as a YAML mapping (for dictionary) or a YAML sequence (for collections).\n        /// If the collection type to serialize is not pure, the type is serialized as a YAML mapping sequence that contains the public properties/fields as well as a\n        /// special fielx (e.g. \"~Items\") that contains the actual items of the collection (either a mapping for dictionary or a sequence for collections).\n        /// The <see cref=\"SpecialCollectionMember\" /> is this special key that is used when serializing items of a non-pure collection.</remarks>\n        public string SpecialCollectionMember\n        {\n            get { return specialCollectionMember; }\n            set\n            {\n                if (value == null)\n                    throw new ArgumentNullException(\"value\", $\"{nameof(specialCollectionMember)} can not be null\");\n\n                // TODO this is a poor check. Need to verify this against the specs\n                if (value.Length < 2 || !(value.Contains(\".\") || value.Contains(\"~\") || value.IndexOf('-') > 0))\n                {\n                    throw new ArgumentException(\n                        \"Expecting length >= 2 and at least a special character '.', '~', '-' (not starting on first char for '-')\");\n                }\n\n                specialCollectionMember = value;\n            }\n        }\n\n        /// <summary>\n        /// Gets the attribute registry.\n        /// </summary>\n        /// <value>The attribute registry.</value>\n        public IAttributeRegistry Attributes\n        {","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs#L233-L269","documentation":"SerializerSettings.SpecialCollectionMember names the property treated as a special collection (must look like a qualified member name, length >= 2, containing '.', '~' or '-' not in first position). Setting it to null throws ArgumentNullException because null is not a meaningful member selector.","triggerScenarios":"`settings.SpecialCollectionMember = null` or assigning a variable that was never initialized.","commonSituations":"Copying settings objects field-by-field and passing through nulls; config lookup returning null for the member name.","solutions":["Assign a valid qualified member name string, e.g. \"Namespace.Type~Member\"","Leave the property unset if no special collection member is needed instead of assigning null"],"exampleFix":"// before\nsettings.SpecialCollectionMember = config.SpecialMember; // null\n// after\nif (config.SpecialMember != null) settings.SpecialCollectionMember = config.SpecialMember;","handlingStrategy":"validation","validationCode":"if (memberName != null) settings.SpecialCollectionMember = memberName;","typeGuard":null,"tryCatchPattern":"try { settings.SpecialCollectionMember = memberName; } catch (ArgumentNullException) { /* leave default */ }","preventionTips":["Only assign the property when a real member name exists","Validate config-provided names before applying them"],"tags":["yaml","serialization","null-argument","configuration"],"backgroundTag":"null-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}