EllanJiang/GameFramework · error · GameFrameworkException
Results is invalid.
Error message
Results is invalid.
What it means
DataNode.GetAllChild(List<IDataNode> results) throws 'Results is invalid.' when the results list argument is null. The method clears and fills the caller-supplied list, so a null list has nowhere to write and the call is rejected upfront. This is a simple null-argument guard on the output parameter.
Solutions
- Initialize the list before calling: new List<IDataNode>()
- Check the list for null before the call if it comes from external code
- Reuse a cached list and rely on the method's internal Clear()
Example fix
// before List<IDataNode> children = null; node.GetAllChild(children); // after List<IDataNode> children = new List<IDataNode>(); node.GetAllChild(children);
Defensive patterns
Strategy: validation
Validate before calling
if (results == null)
{
results = new List<IDataNode>();
}
node.GetAllChild(results); Type guard
bool HasList(List<IDataNode> l) => l != null;
Try / catch
try { node.GetAllChild(results); }
catch (GameFrameworkException) { Log.Error("GetAllChild called with null list"); results = new List<IDataNode>(); } Prevention
- Always instantiate result lists before passing them
- Reuse a cached list — the method clears it anyway
- Initialize List fields at declaration, not on first use
- Wrap list-producing helpers to allocate internally
When it happens
Trigger: Calling node.GetAllChild(null); passing a list property that was never initialized; a helper method forwarding an unassigned List<IDataNode> field.
Common situations: Refactoring where the list was previously created inside the method; C# 'new List<IDataNode>()' omitted when declaring the field; deserialized or pooled lists that are null on first use.
Related errors
- Resource manager is invalid.
- Data provider helper is invalid.
- Owner is invalid.
- Resource manager is invalid.
- Data provider helper is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/ae8f155a111902bf.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/DataNode/DataNodeManager.DataNode.cs:263
public IDataNode[] GetAllChild()
{
if (m_Childs == null)
{
return EmptyDataNodeArray;
}
return m_Childs.ToArray();
}
/// <summary>
/// 获取所有子数据结点。
/// </summary>
/// <param name="results">所有子数据结点。</param>
public void GetAllChild(List<IDataNode> results)
{
if (results == null)
{
throw new GameFrameworkException("Results is invalid.");
}
results.Clear();
if (m_Childs == null)
{
return;
}
foreach (DataNode child in m_Childs)
{
results.Add(child);
}
}
/// <summary>
/// 根据索引移除子数据结点。
/// </summary>
/// <param name="index">子数据结点的索引位置。</param>View on GitHub (pinned to d0c010b051)