EllanJiang/GameFramework · error · GameFrameworkException

Path is invalid.

Error message

Path is invalid.

What it means

DebuggerManager's DebuggerWindowGroup.RegisterDebuggerWindow(path, window) throws this when the path string is null or empty. Paths are hierarchical ('Group/Window') and are used as dictionary keys, so an empty path cannot be registered. This is the group-level guard; the manager-level RegisterDebuggerWindow performs the same check first.

Solutions

  1. Pass a non-empty path containing at least a window name, e.g. "System/MyWindow".
  2. Null/empty-check the path before calling RegisterDebuggerWindow.
  3. If building paths dynamically, validate the source value before formatting.

Example fix

// before
string path = config.WindowPath; // may be empty
debugger.RegisterDebuggerWindow(path, new MyWindow());
// after
if (!string.IsNullOrEmpty(config.WindowPath))
    debugger.RegisterDebuggerWindow(config.WindowPath, new MyWindow());
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(path)) path = "Default/Window";

Type guard

static bool IsValidDebuggerPath(string p) => !string.IsNullOrEmpty(p);

Try / catch

try { group.RegisterDebuggerWindow(path, window); }
catch (GameFrameworkException ex) { Log.Error($"Debugger registration failed: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling RegisterDebuggerWindow with path == null or ""; building paths dynamically (e.g. from a config value or string.Format) that end up empty; passing a variable holding an unset window name.

Common situations: Reading the window path from a config file or inspector field left blank; string splitting producing an empty segment; forgetting to set a const path string.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/52f329fed96f066a. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs:211

                DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName);
                if (debuggerWindowGroup == null || !InternalSelectDebuggerWindow(debuggerWindowGroupName))
                {
                    return false;
                }

                return debuggerWindowGroup.SelectDebuggerWindow(leftPath);
            }

            /// <summary>
            /// 注册调试器窗口。
            /// </summary>
            /// <param name="path">调试器窗口路径。</param>
            /// <param name="debuggerWindow">要注册的调试器窗口。</param>
            public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow)
            {
                if (string.IsNullOrEmpty(path))
                {
                    throw new GameFrameworkException("Path is invalid.");
                }

                int pos = path.IndexOf('/');
                if (pos < 0 || pos >= path.Length - 1)
                {
                    if (InternalGetDebuggerWindow(path) != null)
                    {
                        throw new GameFrameworkException("Debugger window has been registered.");
                    }

                    m_DebuggerWindows.Add(new KeyValuePair<string, IDebuggerWindow>(path, debuggerWindow));
                    RefreshDebuggerWindowNames();
                }
                else
                {
                    string debuggerWindowGroupName = path.Substring(0, pos);
                    string leftPath = path.Substring(pos + 1);
                    DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName);

View on GitHub (pinned to d0c010b051)