{"record":{"id":"0b7f781dded8f547","repo":"stride3d/stride","slug":"ex-message-defaultobjectserializerbackend","errorCode":null,"errorMessage":"ex.Message","messagePattern":"ex\\.Message","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/Serializers/DefaultObjectSerializerBackend.cs","lineNumber":188,"sourceCode":"\n        /// <inheritdoc/>\n        public virtual bool ShouldSerialize(IMemberDescriptor member, ref ObjectContext objectContext) => member.ShouldSerialize(objectContext.Instance, objectContext.ParentTypeMemberDescriptor);\n\n        protected object ReadYaml(ref ObjectContext objectContext)\n        {\n            var node = objectContext.SerializerContext.Reader.Parser.Current;\n            try\n            {\n                return objectContext.SerializerContext.Serializer.ObjectSerializer.ReadYaml(ref objectContext);\n            }\n            catch (YamlException)\n            {\n                throw;\n            }\n            catch (Exception ex)\n            {\n                ex = ex.Unwrap();\n                throw new YamlException(node, ex);\n            }\n        }\n\n        protected void WriteYaml(ref ObjectContext objectContext)\n        {\n            objectContext.SerializerContext.Serializer.ObjectSerializer.WriteYaml(ref objectContext);\n        }\n    }\n}\n","sourceCodeStart":170,"sourceCodeEnd":198,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/Serializers/DefaultObjectSerializerBackend.cs#L170-L198","documentation":"DefaultObjectSerializerBackend.ReadYaml wraps any exception thrown while reading a YAML node value in a YamlException carrying the node's start/end coordinates. The original message (ex.Message) is preserved as the inner/outer message after unwrapping aggregate/target-invocation wrappers.","triggerScenarios":"Any failure during node conversion for a member value, collection item, dictionary key or value: malformed scalars for the target type, converter exceptions, nested serializer failures. Callers: ReadMemberValue, ReadCollectionItem, ReadDictionaryKey, ReadDictionaryValue.","commonSituations":"Typos in numeric/enum scalar values; culture-dependent decimal formats; invalid GUIDs or date formats; exceptions thrown by property setters or converters during assignment.","solutions":["Read the inner exception message in the YamlException to find the real cause","Fix the offending scalar value in the YAML document at the reported node location","Ensure the target property type matches the YAML value format","Use SerializerContext.AllowErrors to skip malformed values instead of failing hard"],"exampleFix":"// before\nsize: big   // property is int -> conversion exception wrapped in YamlException\n// after\nsize: 42","handlingStrategy":"try-catch","validationCode":"// Validate scalars against target types before deserializing\nforeach (var (key, valueText) in yamlFields)\n    if (!valueConverter.CanConvert(key, valueText))\n        throw new YamlException(key, $\"Value '{valueText}' invalid for {key}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    backend.ReadYaml(ref objectContext);\n}\ncatch (YamlException ex)\n{\n    logger.LogError(ex, \"YAML read failed at {Start}-{End}: {Inner}\", ex.Start, ex.End, ex.InnerException?.Message);\n}","preventionTips":["Match YAML scalar formats to property types (culture-invariant numbers, valid GUIDs/dates)","Inspect InnerException for the root cause","Use AllowErrors for lenient deserialization of untrusted files"],"tags":["yaml","deserialization","exception-wrapping"],"backgroundTag":"yaml-parse-error","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"}