{"record":{"id":"7393a6310ea4134a","repo":"EllanJiang/GameFramework","slug":"debugger-window-has-been-registered","errorCode":null,"errorMessage":"Debugger window has been registered.","messagePattern":"Debugger window has been registered\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs","lineNumber":219,"sourceCode":"\n            /// <summary>\n            /// 注册调试器窗口。\n            /// </summary>\n            /// <param name=\"path\">调试器窗口路径。</param>\n            /// <param name=\"debuggerWindow\">要注册的调试器窗口。</param>\n            public void RegisterDebuggerWindow(string path, IDebuggerWindow debuggerWindow)\n            {\n                if (string.IsNullOrEmpty(path))\n                {\n                    throw new GameFrameworkException(\"Path is invalid.\");\n                }\n\n                int pos = path.IndexOf('/');\n                if (pos < 0 || pos >= path.Length - 1)\n                {\n                    if (InternalGetDebuggerWindow(path) != null)\n                    {\n                        throw new GameFrameworkException(\"Debugger window has been registered.\");\n                    }\n\n                    m_DebuggerWindows.Add(new KeyValuePair<string, IDebuggerWindow>(path, debuggerWindow));\n                    RefreshDebuggerWindowNames();\n                }\n                else\n                {\n                    string debuggerWindowGroupName = path.Substring(0, pos);\n                    string leftPath = path.Substring(pos + 1);\n                    DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName);\n                    if (debuggerWindowGroup == null)\n                    {\n                        if (InternalGetDebuggerWindow(debuggerWindowGroupName) != null)\n                        {\n                            throw new GameFrameworkException(\"Debugger window has been registered, can not create debugger window group.\");\n                        }\n\n                        debuggerWindowGroup = new DebuggerWindowGroup();","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs#L201-L237","documentation":"DebuggerWindowGroup.RegisterDebuggerWindow throws this when a leaf path (no further '/' segments) is already occupied by an existing debugger window. The group stores windows keyed by path and forbids duplicate registrations at the same path. Note the same exception text can also surface from the manager-level wrapper when re-registering.","triggerScenarios":"Calling RegisterDebuggerWindow(\"Procedures/ProcedureOverview\") twice without unregistering; re-registering after a domain reload or debugger restart; two different window classes registered under the same path.","commonSituations":"Initialization code running twice (duplicate component init); accidentally reusing a path string for a new window; hot-reload scenarios re-running registration code.","solutions":["Check HasDebuggerWindow(path) before registering, or unregister the existing window first.","Use a unique path for each window type.","Guard initialization code so it runs only once."],"exampleFix":"// before\ndebugger.RegisterDebuggerWindow(\"System/MyWindow\", new MyWindow());\n// after\nif (!debugger.HasDebuggerWindow(\"System/MyWindow\"))\n    debugger.RegisterDebuggerWindow(\"System/MyWindow\", new MyWindow());","handlingStrategy":"validation","validationCode":"if (debugger.HasDebuggerWindow(path)) debugger.UnregisterDebuggerWindow(path);","typeGuard":null,"tryCatchPattern":"try { debugger.RegisterDebuggerWindow(path, window); }\ncatch (GameFrameworkException) { Log.Warning($\"Debugger window '{path}' already registered\"); }","preventionTips":["Call HasDebuggerWindow before every registration","Make registration idempotent (check-then-register)","Guard init code against double execution (domain reload, duplicate Awake)"],"tags":["debugger","duplicate-registration","csharp","gameframework"],"backgroundTag":"file-already-exists","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}