EllanJiang/GameFramework · error · GameFrameworkException
Results is invalid.
Error message
Results is invalid.
What it means
ResourceGroupCollection.GetResourceNames fills a caller-supplied List<string> with the full names of all resources aggregated in the collection. It throws GameFrameworkException("Results is invalid.") when the results list is null, since the list is used directly as the output buffer.
Solutions
- Allocate the list first: var results = new List<string>(); collection.GetResourceNames(results);
- Initialize list fields/variables before passing them to any GetResourceNames overload.
- Catch GameFrameworkException around the call if the list origin is uncertain.
Example fix
// before List<string> names = null; collection.GetResourceNames(names); // after List<string> names = new List<string>(); collection.GetResourceNames(names);
Defensive patterns
Strategy: validation
Validate before calling
if (results == null) results = new List<string>(); collection.GetResourceNames(results);
Type guard
bool IsValidResults(List<string> results) => results != null;
Try / catch
try { collection.GetResourceNames(results); } catch (GameFrameworkException ex) { Log.Error(ex.Message); } Prevention
- Instantiate result lists before calling fill-in APIs
- Use the same list-allocation convention across all Get*Names calls
- Assert non-null arguments in debug builds
When it happens
Trigger: Calling collection.GetResourceNames(null) or with a List<string> variable that is null at call time.
Common situations: Forgetting to instantiate the list before the call; passing the return of another method that returned null; refactoring from an API that returns a list to this fill-in-place API.
Related errors
- Results is invalid.
- Owner is invalid.
- Resource manager is invalid.
- Data provider helper is invalid.
- Type is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/ea57a50f78c875b4.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.ResourceGroupCollection.cs:242
int index = 0;
string[] resourceNames = new string[m_ResourceNames.Count];
foreach (ResourceName resourceName in m_ResourceNames)
{
resourceNames[index++] = resourceName.FullName;
}
return resourceNames;
}
/// <summary>
/// 获取资源组集合包含的资源名称列表。
/// </summary>
/// <param name="results">资源组包含的资源名称列表。</param>
public void GetResourceNames(List<string> results)
{
if (results == null)
{
throw new GameFrameworkException("Results is invalid.");
}
results.Clear();
foreach (ResourceName resourceName in m_ResourceNames)
{
results.Add(resourceName.FullName);
}
}
}
}
}
View on GitHub (pinned to d0c010b051)