{"record":{"id":"25e36f52176f8f1f","repo":"stride3d/stride","slug":"ex-message-arrayserializer","errorCode":null,"errorMessage":"ex.Message","messagePattern":"ex\\.Message","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/Serializers/ArraySerializer.cs","lineNumber":144,"sourceCode":"        }\n\n        private static object ReadYaml(SerializerContext context, Type expectedType)\n        {\n            var node = context.Reader.Parser.Current;\n            try\n            {\n                var objectContext = new ObjectContext(context, null, context.FindTypeDescriptor(expectedType));\n                // TODO: we should go through the ObjectSerializerBackend, not directly use the ObjectSerializer!\n                return context.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        private static void WriteYaml(SerializerContext context, object value, Type expectedType)\n        {\n            var objectContext = new ObjectContext(context, value, context.FindTypeDescriptor(expectedType));\n            // TODO: we should go through the ObjectSerializerBackend, not directly use the ObjectSerializer!\n            context.Serializer.ObjectSerializer.WriteYaml(ref objectContext);\n        }\n\n\n    }\n}\n","sourceCodeStart":126,"sourceCodeEnd":158,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/Serializers/ArraySerializer.cs#L126-L158","documentation":"ArraySerializer.ReadYaml wraps element deserialization: any exception thrown while reading the array is unwrapped of its aggregate layers (ex.Unwrap()) and rethrown as a YamlException tied to the YAML node's start/end marks, so the original message appears wrapped with source location.","triggerScenarios":"Any inner element of a YAML sequence fails to deserialize (bad scalar format, type mismatch, nested error), causing the generic catch to convert it into a YamlException at the array node.","commonSituations":"A value like \"abc\" inside a float[] sequence; nested conversion failures after version upgrades changed element types; large arrays where it's unclear which element failed.","solutions":["Inspect ex.InnerException / the unwrapped message plus the YAML marks to find the failing element and fix its value or the element's declared type","Validate the YAML data against the expected element type before deserialization","Catch YamlException in your loading code and log the Start/End location for diagnosis"],"exampleFix":"// before\nvalues:\n- 1.0\n- abc   # not a float\n// after\nvalues:\n- 1.0\n- 2.0","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return serializer.Deserialize(reader, arrayType); } catch (YamlException ex) { Log.Error(ex, \"Array element failed at {Start}-{End}: {Message}\", ex.Start, ex.End, ex.InnerException?.Message ?? ex.Message); throw; }","preventionTips":["Validate scalar values match the element type before deserialization","Log InnerException — the root cause message is unwrapped into the YamlException","Pin element type expectations when upgrading library versions"],"tags":["yaml","deserialization","exception-wrapping","type-mismatch"],"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-15T23:17:13.987Z"}