{"record":{"id":"ebe7dd6b229141b4","repo":"stride3d/stride","slug":"namingconvention-can-not-be-null","errorCode":null,"errorMessage":"NamingConvention can not be null","messagePattern":"NamingConvention can not be null","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs","lineNumber":209,"sourceCode":"        public IComparer<object> ComparerForKeySorting { get; set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to serialize dictionary items as regular members.s\n        /// </summary>\n        /// <value><c>true</c> if [enable dictionary items as members]; otherwise, <c>false</c>.</value>\n        public bool SerializeDictionaryItemsAsMembers { get; set; }\n\n        /// <summary>\n        /// Gets or sets the naming convention. Default is to output name as-is <see cref=\"DefaultNamingConvention\"/>.\n        /// </summary>\n        /// <value>The naming convention.</value>\n        public IMemberNamingConvention NamingConvention\n        {\n            get { return _namingConvention; }\n            set\n            {\n                if (value == null)\n                    throw new ArgumentNullException(\"value\", $\"{nameof(NamingConvention)} can not be null\");\n                _namingConvention = value;\n            }\n        }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to emit short type name (type, assembly name) or full <see cref=\"Type.AssemblyQualifiedName\"/>. Default is false.\n        /// </summary>\n        /// <value><c>true</c> to emit short type name; otherwise, <c>false</c>.</value>\n        public bool EmitShortTypeName { get { return AssemblyRegistry.UseShortTypeName; } set { AssemblyRegistry.UseShortTypeName = value; } }\n\n        /// <summary>\n        /// Gets the tag type registry.\n        /// </summary>\n        /// <value>The tag type registry.</value>\n        public ITagTypeRegistry TagTypeRegistry { get { return AssemblyRegistry; } }\n\n        /// <summary>\n        /// Gets or sets the default <see cref=\"DataStyle\"/>. Default is <see cref=\"DataStyle.Normal\"/>. See <see cref=\"DynamicStyleFormat\"/> to understand the resolution of styles.","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs#L191-L227","documentation":"SerializerSettings.NamingConvention is a required dependency used to convert member names to/from YAML keys. Assigning null throws ArgumentNullException because the serializer cannot function without a naming convention (e.g. CamelCase, UnderscoreDashed).","triggerScenarios":"Assigning null explicitly: `settings.NamingConvention = null`, or passing a null-returning factory/resolved value into the property.","commonSituations":"Resolving the convention via DI or a config string lookup that fails and returns null; refactor removing a default convention instance.","solutions":["Assign a concrete IMemberNamingConvention such as new CamelCaseNamingConvention() or CoreYamlNamingConvention.Instance","Guard any lookup that produces the convention before assigning it"],"exampleFix":"// before\nsettings.NamingConvention = null;\n// after\nsettings.NamingConvention = new CamelCaseNamingConvention();","handlingStrategy":"validation","validationCode":"if (convention == null) convention = new CamelCaseNamingConvention();\nsettings.NamingConvention = convention;","typeGuard":"bool IsValidConvention(IMemberNamingConvention c) => c != null;","tryCatchPattern":"try { settings.NamingConvention = convention; } catch (ArgumentNullException) { settings.NamingConvention = new CamelCaseNamingConvention(); }","preventionTips":["Resolve naming conventions with a null-safe fallback before assignment","Keep a default convention instance in shared settings builders"],"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"}