{"record":{"id":"9f445e649089f01b","repo":"stride3d/stride","slug":"could-not-process-serialization-for-member-serializableitem","errorCode":null,"errorMessage":"Could not process serialization for member {serializableItem.MemberInfo}","messagePattern":"Could not process serialization for member (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.AssemblyProcessor/Serializers/CecilSerializerContext.cs","lineNumber":253,"sourceCode":"\n            var resolvedType = serializableItem.Type.Resolve();\n            var isInterface = resolvedType?.IsInterface == true;\n\n            try\n            {\n                if (ResolveSerializer(serializableItem.Type, profile: profile) == null)\n                {\n                    IgnoredMembers.Add(serializableItem.MemberInfo);\n                    if (!isInterface)\n                    {\n                        log.Write(\n                            $\"Warning: Member {serializableItem.MemberInfo} does not have a valid serializer. Add [DataMemberIgnore], turn the member non-public, or add a [DataContract] to it's type.\");\n                    }\n                }\n            }\n            catch (Exception e)\n            {\n                throw new InvalidOperationException($\"Could not process serialization for member {serializableItem.MemberInfo}\", e);\n            }\n        }\n\n        // Cache final serializable items (after ignored members have been updated)\n        if (descriptor is not null)\n            descriptor.SerializableItems = SerializationHelpers.GetSerializableItems(type, true, ignoredMembers: IgnoredMembers).ToArray();\n    }\n\n    /// <summary>\n    /// Finds the serializer information by inspecting the type's attributes and inheritance chain.\n    /// </summary>\n    internal SerializableTypeInfo FindSerializerInfo(TypeReference type, bool generic)\n    {\n        if (type == null || type.FullName == typeof(object).FullName || type.FullName == typeof(ValueType).FullName || type.IsGenericParameter)\n            return null;\n\n        var resolvedType = type.Resolve();\n","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.AssemblyProcessor/Serializers/CecilSerializerContext.cs#L235-L271","documentation":"The AssemblyProcessor's serializer dependency collector (CollectSerializerDependencies) throws this when processing a member's serializer raises any exception. It wraps the original exception (inner exception holds the real cause) and names the offending MemberInfo, typically because a serializable member's type has no valid DataSerializer.","triggerScenarios":"CollectSerializerDependencies hits a member whose resolved type cannot be resolved to a serializer (e.g. a type without [DataContract]/[DataSerializer], an unsupported nested-generic type, or an exception inside the serializer factory); the catch-all wraps it as InvalidOperationException.","commonSituations":"A user adds a new class to a data contract but forgets [DataContract] or [DataMemberIgnore]; a member references a third-party type the processor cannot serialize; a refactoring introduces a nested type with parent generic parameters.","solutions":["Read the InnerException for the real cause and fix that underlying serializer issue","Add [DataMemberIgnore] to the offending member if it should not be serialized","Make the member non-public so it is not picked up as serializable","Add [DataContract] (and a DataSerializer if needed) to the member's type","Register a custom DataSerializer for the member's type via [DataSerializer] attribute"],"exampleFix":"// before\npublic class Enemy\n{\n    public Texture MyTexture { get; set; } // no serializer\n}\n// after\npublic class Enemy\n{\n    [DataMemberIgnore]\n    public Texture MyTexture { get; set; }\n}","handlingStrategy":"validation","validationCode":"// Duplicate guard entry (index repeated in input): audit members before processing\nforeach (var member in CollectSerializableMembers(type))\n    if (!HasResolvableSerializer(member))\n        Console.WriteLine($\"[warn] {member} has no serializer; add [DataMemberIgnore] or [DataContract]\");","typeGuard":"static bool HasResolvableSerializer(MemberInfo m) =>\n    m.IsDefined(typeof(DataMemberIgnoreAttribute)) || HasSerializer(GetMemberType(m));","tryCatchPattern":"try { CollectSerializerDependencies(type); }\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Could not process serialization for member\"))\n{\n    logger.Error($\"{ex.Message} caused by: {ex.InnerException?.Message}\");\n}","preventionTips":["Always read InnerException — this is a wrapper","Add [DataMemberIgnore] to non-serializable members","Annotate all serialized types with [DataContract]"],"tags":["serialization","assembly-processor","reflection"],"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-15T23:17:13.987Z"}