EllanJiang/GameFramework · error · GameFrameworkException
Results is invalid.
Error message
Results is invalid.
What it means
ResourceManager.ResourceGroup.GetResourceNames fills a caller-supplied List<string> with the full names of all resources in the group. The library throws GameFrameworkException("Results is invalid.") when the results list reference is null, because it uses the list as its output buffer (Clear + Add) and cannot write into a null list.
Solutions
- Allocate the list before calling: var results = new List<string>(); group.GetResourceNames(results);
- Audit all call sites of GetResourceNames for possibly-null arguments and initialize them.
- Wrap the call in try-catch on GameFrameworkException if the list may come from external code.
Example fix
// before List<string> names = null; group.GetResourceNames(names); // after List<string> names = new List<string>(); group.GetResourceNames(names);
Defensive patterns
Strategy: validation
Validate before calling
if (results == null) results = new List<string>(); group.GetResourceNames(results);
Type guard
bool IsValidResults(List<string> results) => results != null;
Try / catch
try { group.GetResourceNames(results); } catch (GameFrameworkException ex) { Log.Error(ex.Message); } Prevention
- Always instantiate result lists at declaration
- Treat Get*Names(list) APIs as fill-in-place, not returning APIs
- Add Debug.Assert(results != null) at call sites in debug builds
When it happens
Trigger: Calling ResourceGroup.GetResourceNames(null) (or a List<string> variable that is still null at call time).
Common situations: Developers declare the list but forget to instantiate it before passing it in, or pass the result of a helper method that returned null; common when refactoring from a method that returned a new list to this fill-in-list 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/28f4bf61d3d0490a.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.ResourceGroup.cs:200
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);
}
}
/// <summary>
/// 获取资源组包含的资源名称列表。
/// </summary>
/// <returns>资源组包含的资源名称列表。</returns>
public ResourceName[] InternalGetResourceNames()
{
int index = 0;
ResourceName[] resourceNames = new ResourceName[m_ResourceNames.Count];
foreach (ResourceName resourceName in m_ResourceNames)View on GitHub (pinned to d0c010b051)