{"record":{"id":"160b6c905a920d4a","repo":"EllanJiang/GameFramework","slug":"can-not-parse-data-row-bytes-for-data-table-0-with-exception","errorCode":null,"errorMessage":"Can not parse data row bytes for data table '{0}' with exception '{1}'.","messagePattern":"Can not parse data row bytes for data table '(.+?)' with exception '(.+?)'\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/DataTable/DataTableManager.DataTable.cs","lineNumber":425,"sourceCode":"                try\n                {\n                    T dataRow = new T();\n                    if (!dataRow.ParseDataRow(dataRowBytes, startIndex, length, userData))\n                    {\n                        return false;\n                    }\n\n                    InternalAddDataRow(dataRow);\n                    return true;\n                }\n                catch (Exception exception)\n                {\n                    if (exception is GameFrameworkException)\n                    {\n                        throw;\n                    }\n\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not parse data row bytes for data table '{0}' with exception '{1}'.\", new TypeNamePair(typeof(T), Name), exception), exception);\n                }\n            }\n\n            /// <summary>\n            /// 移除指定数据表行。\n            /// </summary>\n            /// <param name=\"id\">要移除数据表行的编号。</param>\n            /// <returns>是否移除数据表行成功。</returns>\n            public override bool RemoveDataRow(int id)\n            {\n                if (!HasDataRow(id))\n                {\n                    return false;\n                }\n\n                if (!m_DataSet.Remove(id))\n                {\n                    return false;","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/DataTable/DataTableManager.DataTable.cs#L407-L443","documentation":"Wrapping error thrown by DataTable<T>.AddDataRow(byte[]) when parsing the raw data row bytes fails with a non-GameFrameworkException. The message includes the table identity (row type + name) and the inner exception, which is preserved as InnerException.","triggerScenarios":"Calling AddDataRow(byte[] dataRow) with bytes that the data provider cannot deserialize into T — corrupt data, wrong encoding, truncated buffer, or an exception thrown inside the parse helper.","commonSituations":"Resource files corrupted or partially downloaded; wrong encryption offset; version mismatch between serialized bytes and the row class; binary data built for a different table.","solutions":["Check InnerException for the root cause.","Re-download/rebuild the data asset; verify file integrity.","Confirm the byte layout/encoding matches what the data provider expects.","Keep the row class and data export pipeline in the same version."],"exampleFix":"// before\nbyte[] data = File.ReadAllBytes(path); // file truncated by bad download\ntable.AddDataRow(data);\n// after\nbyte[] data = File.ReadAllBytes(path);\n// verify checksum / length before parsing\ntable.AddDataRow(data);","handlingStrategy":"try-catch","validationCode":"if (dataRow == null || dataRow.Length == 0) throw new InvalidDataException(\"Empty data row bytes\");","typeGuard":null,"tryCatchPattern":"try { table.AddDataRow(bytes); } catch (GameFrameworkException ex) { var root = ex.InnerException; Log.Error($\"Bad byte row for {table.Name}: {root}\"); }","preventionTips":["Verify asset integrity (size/checksum) before parsing","Keep serialization format and row class versions in sync","Check decryption/offset parameters match the build settings","Always inspect InnerException for the parse root cause"],"tags":["csharp","datatable","parse-error","bytes"],"backgroundTag":"schema-validation-failed","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}