{"record":{"id":"e914ec762baff00e","repo":"stride3d/stride","slug":"expecting-length-2-and-at-least-a-special-character-not","errorCode":null,"errorMessage":"Expecting length >= 2 and at least a special character '.', '~', '-' (not starting on first char for '-')","messagePattern":"Expecting length >= 2 and at least a special character '\\.', '~', '-' \\(not starting on first char for '-'\\)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs","lineNumber":256,"sourceCode":"        /// <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        {\n            get { return attributeRegistry; }\n            set\n            {\n                if (value == null)\n                    throw new ArgumentNullException(\"value\", $\"{nameof(Attributes)} can not be null\");","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs#L238-L274","documentation":"SpecialCollectionMember must be a string of length >= 2 containing at least one of the characters '.', '~', or '-' (with '-' not allowed as the first character), because the value is interpreted as a qualified member pattern rather than a plain name. Plain names or too-short strings throw ArgumentException.","triggerScenarios":"Setting SpecialCollectionMember to values like \"x\", \"items\", \"a-\", or any string lacking '.', '~' and a non-initial '-'.","commonSituations":"Typing a bare property name instead of the fully qualified pattern; trimming/cleaning config values so separators are lost.","solutions":["Use the fully qualified form including a type separator, e.g. \"MyNamespace.MyType~MyCollection\" or \"MyNamespace.MyType.Member\"","Ensure length >= 2 and that '-' is not the first character"],"exampleFix":"// before\nsettings.SpecialCollectionMember = \"Items\";\n// after\nsettings.SpecialCollectionMember = \"MyApp.Model.MyType~Items\";","handlingStrategy":"validation","validationCode":"bool IsValidSpecialMember(string v) => v != null && v.Length >= 2 && (v.Contains(\".\") || v.Contains(\"~\") || v.IndexOf('-') > 0);\nif (!IsValidSpecialMember(memberName)) throw new FormatException($\"{memberName} is not a qualified special collection member\");","typeGuard":"bool IsValidSpecialMember(string v) => v != null && v.Length >= 2 && (v.Contains(\".\") || v.Contains(\"~\") || v.IndexOf('-') > 0);","tryCatchPattern":"try { settings.SpecialCollectionMember = memberName; } catch (ArgumentException ex) { throw new FormatException(\"Invalid SpecialCollectionMember\", ex); }","preventionTips":["Always use fully qualified member patterns (Type.Member or Type~Member)","Never assign bare property names or single characters"],"tags":["yaml","serialization","invalid-argument-format","configuration"],"backgroundTag":"invalid-argument-format","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}