EllanJiang/GameFramework · error · GameFrameworkException
Results is invalid.
Error message
Results is invalid.
What it means
GetCanReleaseObjects fills a caller-provided List<T> with objects eligible for release. A null list cannot be filled, so the pool throws 'Results is invalid.' The list is reused by CanReleaseCount, Release(count, filter) and ReleaseAllUnused to avoid allocations.
Solutions
- Always construct and pass a valid List<T> instance (it may be empty; it is cleared first).
- In custom code, prefer the public Release/CanReleaseCount APIs which allocate the list correctly.
- If maintaining a fork, add lazy initialization: results ??= new List<T>().
Example fix
// before List<T> results = null; GetCanReleaseObjects(results); // after List<T> results = new List<T>(); GetCanReleaseObjects(results);
Defensive patterns
Strategy: validation
Validate before calling
var results = new List<T>();
if (results != null)
{
GetCanReleaseObjects(results);
} Try / catch
try { GetCanReleaseObjects(results); }
catch (GameFrameworkException) { /* results list was null; allocate and retry */ } Prevention
- Always allocate the results list before invoking the helper.
- Prefer public Release/CanReleaseCount APIs over private internals.
- In forks, lazy-initialize list parameters.
When it happens
Trigger: Internal call paths passing a non-initialized list — practically triggered if subclass/modified code overrides or invokes this private helper with null, or custom builds call it directly.
Common situations: Custom forks of GameFramework extending ObjectPool with their own release logic; reflection-based tooling invoking private methods with incomplete arguments.
Related errors
- Target ' ' is invalid.
- Object is invalid.
- Object is invalid.
- Release object filter callback is invalid.
- Object type is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/e23670c4a656488e.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs:581
if (target == null)
{
throw new GameFrameworkException("Target is invalid.");
}
Object<T> internalObject = null;
if (m_ObjectMap.TryGetValue(target, out internalObject))
{
return internalObject;
}
return null;
}
private void GetCanReleaseObjects(List<T> results)
{
if (results == null)
{
throw new GameFrameworkException("Results is invalid.");
}
results.Clear();
foreach (KeyValuePair<object, Object<T>> objectInMap in m_ObjectMap)
{
Object<T> internalObject = objectInMap.Value;
if (internalObject.IsInUse || internalObject.Locked || !internalObject.CustomCanReleaseFlag)
{
continue;
}
results.Add(internalObject.Peek());
}
}
private List<T> DefaultReleaseObjectFilterCallback(List<T> candidateObjects, int toReleaseCount, DateTime expireTime)
{
m_CachedToReleaseObjects.Clear();View on GitHub (pinned to d0c010b051)