EllanJiang/GameFramework · error · GameFrameworkException
Can not parse data string with exception
Error message
Can not parse data string with exception '{0}'. What it means
ParseData(string, object) wraps the helper's ParseData call in a try/catch. If the helper throws any exception other than a GameFrameworkException, it is re-wrapped as this GameFrameworkException carrying the original exception's message and preserved as InnerException. It means the helper itself crashed while parsing the string.
Solutions
- Inspect the InnerException of this GameFrameworkException to find the real cause.
- Validate/repair the data string format before parsing.
- Fix the throwing code path inside the custom IDataProviderHelper implementation.
- Version-check the data string against what the helper expects.
Example fix
// before
throw new GameFrameworkException(Utility.Text.Format("Can not parse data string with exception '{0}'.", exception), exception);
// after (caller side)
try { dataProvider.ParseData(text, null); }
catch (GameFrameworkException e) { Log.Error("Parse failed: {0}", e.InnerException); } Defensive patterns
Strategy: try-catch
Try / catch
try { dataProvider.ParseData(text, null); }
catch (GameFrameworkException e) when (e.Message.StartsWith("Can not parse data string")) { Log.Error("Helper parse crash: {0}", e.InnerException); } Prevention
- Always inspect InnerException for the root cause.
- Validate data string format/version before parsing.
- Add defensive checks in custom IDataProviderHelper implementations.
When it happens
Trigger: IDataProviderHelper.ParseData(owner, dataString, userData) throws (NullReferenceException, FormatException, custom helper bug, etc.) during string parsing.
Common situations: Malformed JSON/XML/config text fed to the helper; helper assumes a field or structure that is absent; bug in a custom data provider helper implementation.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- Can not parse data bytes with exception
- Load data failure in data provider helper, data asset name
- Entity helper is invalid.
- Entity helper is invalid.
- Parse updatable version list exception
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/139520eaf7496ddd.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Base/DataProvider/DataProvider.cs:287
}
if (dataString == null)
{
throw new GameFrameworkException("Data string is invalid.");
}
try
{
return m_DataProviderHelper.ParseData(m_Owner, dataString, userData);
}
catch (Exception exception)
{
if (exception is GameFrameworkException)
{
throw;
}
throw new GameFrameworkException(Utility.Text.Format("Can not parse data string with exception '{0}'.", exception), exception);
}
}
/// <summary>
/// 解析内容。
/// </summary>
/// <param name="dataBytes">要解析的内容二进制流。</param>
/// <returns>是否解析内容成功。</returns>
public bool ParseData(byte[] dataBytes)
{
if (dataBytes == null)
{
throw new GameFrameworkException("Data bytes is invalid.");
}
return ParseData(dataBytes, 0, dataBytes.Length, null);
}
View on GitHub (pinned to d0c010b051)