{"record":{"id":"e98f0abea7ba8a9d","repo":"EllanJiang/GameFramework","slug":"can-not-parse-data-row-string-for-data-table-0-with","errorCode":null,"errorMessage":"Can not parse data row string for data table '{0}' with exception '{1}'.","messagePattern":"Can not parse data row string for data table '(.+?)' with exception '(.+?)'\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/DataTable/DataTableManager.DataTable.cs","lineNumber":393,"sourceCode":"                try\n                {\n                    T dataRow = new T();\n                    if (!dataRow.ParseDataRow(dataRowString, 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 string 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=\"dataRowBytes\">要解析的数据表行二进制流。</param>\n            /// <param name=\"startIndex\">数据表行二进制流的起始位置。</param>\n            /// <param name=\"length\">数据表行二进制流的长度。</param>\n            /// <param name=\"userData\">用户自定义数据。</param>\n            /// <returns>是否增加数据表行成功。</returns>\n            public override bool AddDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)\n            {\n                try\n                {\n                    T dataRow = new T();\n                    if (!dataRow.ParseDataRow(dataRowBytes, startIndex, length, userData))\n                    {","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/DataTable/DataTableManager.DataTable.cs#L375-L411","documentation":"Wrapping error thrown by DataTable<T>.AddDataRow(string) when parsing the data row text fails with any exception other than a GameFrameworkException. The original parse exception is preserved as InnerException and the message names the table (TypeNamePair of row type and table name) plus the underlying exception.","triggerScenarios":"Calling AddDataRow with a malformed data row string whose text cannot be parsed into T by the data provider, e.g. wrong column count, bad number format, or a parsing helper throwing (IndexOutOfRange, FormatException, NullReferenceException).","commonSituations":"Editing spreadsheet-exported text files by hand; locale/decimal-separator changes; schema drift between the row class and the file; empty or truncated line.","solutions":["Inspect InnerException to find the actual parse failure.","Check the row string matches the table's column layout and separator.","Regenerate/export the data file from source; do not hand-edit.","Validate field formats (numbers, enums) against the T class definition."],"exampleFix":"// before\nint count = string.Concat(parts).Split('\\t').Length; // hand-edited row, wrong columns\ntable.AddDataRow(text);\n// after\n// re-export the row so the tab-separated columns match the DataRow class\ntable.AddDataRow(text); // with try/catch on GameFrameworkException reading InnerException","handlingStrategy":"try-catch","validationCode":"if (string.IsNullOrWhiteSpace(rowText)) throw new InvalidDataException(\"Empty data row string\");","typeGuard":null,"tryCatchPattern":"try { table.AddDataRow(rowText); } catch (GameFrameworkException ex) { var root = ex.InnerException; Log.Error($\"Bad row for {table.Name}: {root}\"); }","preventionTips":["Export data files from the pipeline; never hand-edit row text","Match column count/types to the DataRow class definition","Watch InnerException — this error is always a wrapper","Beware locale-dependent number parsing in row strings"],"tags":["csharp","datatable","parse-error"],"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"}