{"record":{"id":"af1731528fe4cdb7","repo":"stride3d/stride","slug":"fixedbuffer-attribute-is-not-supported","errorCode":null,"errorMessage":"FixedBuffer attribute is not supported.","messagePattern":"FixedBuffer attribute is not supported\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.AssemblyProcessor/SerializationProcessor.cs","lineNumber":318,"sourceCode":"\n                // Check mode\n                if (archiveMode == ArchiveMode.Serialize)\n                {\n                    il.Emit(OpCodes.Ldarg_2)\n                      .Emit(OpCodes.Ldc_I4, (int)archiveMode)\n                      .Emit(OpCodes.Ceq)\n                      .Emit(OpCodes.Brfalse, deserializeLabel);\n                }\n                else\n                {\n                    il.MarkLabel(deserializeLabel);\n                }\n\n                foreach (var serializableItem in ctx.SerializableItems)\n                {\n                    if (serializableItem.HasFixedAttribute)\n                    {\n                        throw new NotImplementedException(\"FixedBuffer attribute is not supported.\");\n                    }\n\n                    var memberAssignBack = serializableItem.AssignBack;\n                    var memberVariableName = (serializableItem.MemberInfo is PropertyDefinition || !memberAssignBack) ? SerializationHelpers.CreateMemberVariableName(serializableItem.MemberInfo) : null;\n                    var serializableItemInfo = ctx.SerializableItemInfos[serializableItem.Type];\n                    il.Emit(OpCodes.Ldarg_0)\n                      .Emit(OpCodes.Ldfld, serializableItemInfo.SerializerField.MakeGeneric(ctx.GenericParameters));\n\n                    var fieldReference = serializableItem.MemberInfo is FieldReference ? il.Import((FieldReference)serializableItem.MemberInfo).MakeGeneric(ctx.GenericParameters) : null;\n\n                    if (memberVariableName != null)\n                    {\n                        // Properties (and non-assignback fields) need a temp variable:\n                        //   var tmp = obj.Member;           // serialize path\n                        //   var tmp = default(MemberType);  // deserialize path\n                        if (!ctx.LocalsByTypes.TryGetValue(serializableItemInfo.Type, out var tempLocal))\n                        {\n                            tempLocal = il.AddLocal(serializableItemInfo.Type);","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.AssemblyProcessor/SerializationProcessor.cs#L300-L336","documentation":"SerializationProcessor.GenerateSerializeMethod throws this NotImplementedException when a serializable member is marked with the FixedBuffer attribute; fixed-buffer serialization is not implemented in the generated serializer path, so processing aborts.","triggerScenarios":"A type registered for serialization has a member with FixedSizeBuffer/FixedBuffer attribute that reaches the generate-serialize-method loop.","commonSituations":"Using C# unsafe fixed buffers or Stride's fixed-size buffer attributes inside structs/components intended to be serialized; porting native-style interop structs into serialized data contracts.","solutions":["Remove the FixedBuffer attribute and replace the member with a regular array (e.g. byte[]) or a struct of fixed-size fields","Wrap the buffer in a serializable struct containing normal fields","Exclude the member/type from serialization if the buffer is runtime-only data","Implement custom serialization (or upgrade Stride) if fixed buffers are required"],"exampleFix":"// before\n[FixedBuffer(typeof(byte), 16)] public unsafe fixed byte Data[16];\n// after\npublic byte[] Data = new byte[16]; // regular serializable array","handlingStrategy":"validation","validationCode":"if (field.GetCustomAttribute<FixedBufferAttribute>() != null)\n    throw new NotSupportedException(\"Remove FixedBuffer fields from serialized types\");","typeGuard":"bool HasFixedBuffer(Type t) => t.GetFields().Any(f => f.GetCustomAttributes(typeof(FixedBufferAttribute), true).Any());","tryCatchPattern":"catch (NotImplementedException) when (ex.Message == \"FixedBuffer attribute is not supported.\")\n{\n    // replace the fixed buffer with a plain array/struct and rebuild\n}","preventionTips":["Avoid fixed buffers in serialized data contracts","Use byte[] or plain structs for fixed-size data","Document interop-only structs separately from serialized types"],"tags":["il-weaving","serialization","fixed-buffer","assemblyprocessor"],"backgroundTag":"unsupported-operation","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"}