{"record":{"id":"0e520af27886be98","repo":"stride3d/stride","slug":"unable-to-deserialize-property-membername-not-found-in-type","errorCode":null,"errorMessage":"Unable to deserialize property [{memberName}] not found in type [{objectContext.Descriptor}]","messagePattern":"Unable to deserialize property \\[(.+?)\\] not found in type \\[(.+?)\\]","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/Serializers/ObjectSerializer.cs","lineNumber":195,"sourceCode":"            while (!reader.Accept<TEnd>())\n            {\n                ReadMember(ref objectContext);\n            }\n            reader.Expect<TEnd>();\n        }\n\n        /// <summary>\n        /// Reads an item of the object from the YAML flow (either a sequence item or mapping key/value item).\n        /// </summary>\n        /// <param name=\"objectContext\"></param>\n        /// <exception cref=\"YamlException\">Unable to deserialize property [{0}] not found in type [{1}].DoFormat(propertyName, typeDescriptor)</exception>\n        protected virtual void ReadMember(ref ObjectContext objectContext)\n        {\n            Scalar memberScalar;\n            string memberName;\n            if (!TryReadMember(ref objectContext, out memberScalar, out memberName))\n            {\n                throw new YamlException(memberScalar.Start, memberScalar.End, $\"Unable to deserialize property [{memberName}] not found in type [{objectContext.Descriptor}]\");\n            }\n        }\n\n        /// <summary>\n        /// Tries to read a member.\n        /// </summary>\n        /// <param name=\"objectContext\">The object context.</param>\n        /// <param name=\"memberName\">Name of the member.</param>\n        /// <returns><c>true</c> if the member was successfully read, <c>false</c> otherwise.</returns>\n        protected bool TryReadMember(ref ObjectContext objectContext, out string memberName)\n        {\n            Scalar scalar;\n            return TryReadMember(ref objectContext, out scalar, out memberName);\n        }\n\n        /// <summary>\n        /// Tries to read an item of the object from the YAML flow (either a sequence item or mapping key/value item).\n        /// </summary>","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/Serializers/ObjectSerializer.cs#L177-L213","documentation":"During deserialization, a YAML key (member scalar) did not match any member of the target type. ObjectSerializer.ReadMember throws this YamlException at the offending scalar's span when TryReadMember fails to map the name to a property/field.","triggerScenarios":"A YAML key in a mapping that doesn't correspond to any property/field of the target type — renames, typos, removed members, or missing serialization metadata (DataMember attributes) after refactors.","commonSituations":"Renaming a C# property while old config/asset files still use the old name; serialized data produced by a newer/older assembly version; case-sensitivity mismatches; hand-edited YAML files.","solutions":["Fix or remove the unknown key in the YAML at the reported span","Rename the YAML key to match the current property name (or add DataMember(Name=...) to restore the old name)","Enable SerializerContext.AllowErrors to ignore unknown members instead of throwing","Use version-tolerant members: keep [DataMember] names stable across refactors"],"exampleFix":"// before\nclass Model { public int Count { get; set; } }\nyaml: count: 5   // lowercase, no match\n// after\ncount -> Count  (fix the YAML key) or add [DataMember(Name = \"count\")]","handlingStrategy":"try-catch","validationCode":"// Pre-validate YAML keys against the type\nvar valid = memberType.GetProperties().Select(p => p.Name)\n    .Concat(memberType.GetFields().Select(f => f.Name)).ToHashSet();\nvar unknown = yamlKeys.Where(k => !valid.Contains(k)).ToList();\nif (unknown.Any()) throw new YamlException($\"Unknown members: {string.Join(\",\", unknown)}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    serializer.Deserialize<Model>(reader);\n}\ncatch (YamlException ex) when (ex.Message.Contains(\"Unable to deserialize property\"))\n{\n    logger.LogWarning(\"Unknown member at {Start}-{End}: {Msg}\", ex.Start, ex.End, ex.Message);\n    // migrate/rename the key and retry\n}","preventionTips":["Keep [DataMember] names stable across refactors","Run schema migration on old asset/config files after property renames","Use AllowErrors to tolerate forward-compat documents","Pin serialized model property names in unit tests"],"tags":["yaml","deserialization","unknown-member"],"backgroundTag":"schema-validation-failed","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}