EllanJiang/GameFramework · error · GameFrameworkException

Debugger window is invalid.

Error message

Debugger window is invalid.

What it means

DebuggerManager.RegisterDebuggerWindow throws this when the debuggerWindow instance is null. After validating the path, the manager checks the window reference before registering it in the root group and calling Initialize(args). A null window cannot be initialized or rendered.

Solutions

  1. Instantiate the window class before registering: new MyDebuggerWindow().
  2. Check the instance for null before calling RegisterDebuggerWindow.
  3. Fix the factory/creation logic that returned null.

Example fix

// before
IMyWindow win = CreateWindow(); // may be null
debugger.RegisterDebuggerWindow("Custom/My", win);
// after
var win = CreateWindow() ?? new MyDebuggerWindow();
debugger.RegisterDebuggerWindow("Custom/My", win);
Defensive patterns

Strategy: type-guard

Validate before calling

if (window == null) window = new MyDebuggerWindow();

Type guard

static bool IsValidWindow(IDebuggerWindow w) => w != null;

Try / catch

try { debugger.RegisterDebuggerWindow(path, window, args); }
catch (GameFrameworkException) { Log.Warning("Cannot register a null debugger window"); }

Prevention

When it happens

Trigger: Passing null instead of an IDebuggerWindow instance; passing a factory result that returned null; conditionally created window instances that ended up null (e.g. #if-compiled-out class).

Common situations: Custom debugger windows behind compilation symbols that resolve to null in some build configurations; DI/factory failures returning null; copy-paste forgetting to instantiate the window.

Related errors


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

Appendix: source

Thrown at GameFramework/Debugger/DebuggerManager.cs:104

            m_DebuggerWindowRoot.Shutdown();
        }

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

            if (debuggerWindow == null)
            {
                throw new GameFrameworkException("Debugger window is invalid.");
            }

            m_DebuggerWindowRoot.RegisterDebuggerWindow(path, debuggerWindow);
            debuggerWindow.Initialize(args);
        }

        /// <summary>
        /// 解除注册调试器窗口。
        /// </summary>
        /// <param name="path">调试器窗口路径。</param>
        /// <returns>是否解除注册调试器窗口成功。</returns>
        public bool UnregisterDebuggerWindow(string path)
        {
            return m_DebuggerWindowRoot.UnregisterDebuggerWindow(path);
        }

        /// <summary>
        /// 获取调试器窗口。

View on GitHub (pinned to d0c010b051)