EllanJiang/GameFramework · error · GameFrameworkException
Results is invalid.
Error message
Results is invalid.
What it means
GameFrameworkManager.GetAllFileSystems copies all registered file systems into a caller-supplied List<IFileSystem>. The method requires a non-null results list to fill; it refuses to allocate one itself. If you pass null, FileSystemManager.cs:273 throws this GameFrameworkException immediately.
Solutions
- Pass a non-null List<IFileSystem> instance: var results = new List<IFileSystem>(); fileSystemComponent.GetAllFileSystems(results);
- If the list may come from elsewhere, check for null before calling and create a new one when needed.
Example fix
// before List<IFileSystem> results = null; fileSystemComponent.GetAllFileSystems(results); // after List<IFileSystem> results = new List<IFileSystem>(); fileSystemComponent.GetAllFileSystems(results);
Defensive patterns
Strategy: validation
Validate before calling
if (results == null) { results = new List<IFileSystem>(); }
fileSystemComponent.GetAllFileSystems(results); Type guard
bool IsValidResults(List<IFileSystem> results) => results != null;
Try / catch
try { fileSystemComponent.GetAllFileSystems(results); }
catch (GameFrameworkException) { results = new List<IFileSystem>(); fileSystemComponent.GetAllFileSystems(results); } Prevention
- Always instantiate the results list at the call site rather than accepting one from upstream.
- Treat GetAllFileSystems as fill-in-place: it never allocates, so the list must exist first.
When it happens
Trigger: Calling GetAllFileSystems(null) — the only condition in the guard at FileSystemManager.cs:273. The list contents are irrelevant (it is cleared), only nullness is checked.
Common situations: Passing a field that was never initialized; forwarding a result of another method that returned null; refactoring away an uninitialized List<IFileSystem> member in a Unity component.
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/0f70a390befe67d5.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/FileSystem/FileSystemManager.cs:273
int index = 0;
IFileSystem[] results = new IFileSystem[m_FileSystems.Count];
foreach (KeyValuePair<string, FileSystem> fileSystem in m_FileSystems)
{
results[index++] = fileSystem.Value;
}
return results;
}
/// <summary>
/// 获取所有文件系统集合。
/// </summary>
/// <param name="results">获取的所有文件系统集合。</param>
public void GetAllFileSystems(List<IFileSystem> results)
{
if (results == null)
{
throw new GameFrameworkException("Results is invalid.");
}
results.Clear();
foreach (KeyValuePair<string, FileSystem> fileSystem in m_FileSystems)
{
results.Add(fileSystem.Value);
}
}
}
}
View on GitHub (pinned to d0c010b051)