{"record":{"id":"008ba64859b3d879","repo":"EllanJiang/GameFramework","slug":"debugger-window-has-been-registered-can-not-create-debugger","errorCode":null,"errorMessage":"Debugger window has been registered, can not create debugger window group.","messagePattern":"Debugger window has been registered, can not create debugger window group\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs","lineNumber":234,"sourceCode":"                {\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();\n                        m_DebuggerWindows.Add(new KeyValuePair<string, IDebuggerWindow>(debuggerWindowGroupName, debuggerWindowGroup));\n                        RefreshDebuggerWindowNames();\n                    }\n\n                    debuggerWindowGroup.RegisterDebuggerWindow(leftPath, debuggerWindow);\n                }\n            }\n\n            /// <summary>\n            /// 解除注册调试器窗口。\n            /// </summary>\n            /// <param name=\"path\">调试器窗口路径。</param>\n            /// <returns>是否解除注册调试器窗口成功。</returns>\n            public bool UnregisterDebuggerWindow(string path)\n            {","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs#L216-L252","documentation":"When registering 'Group/Sub/Window', the group prefix 'Group/Sub' must either be free or already be a DebuggerWindowGroup. This error is thrown when the prefix path exists but is a plain debugger window, so a group cannot be created there. The path hierarchy is therefore inconsistent with the new registration.","triggerScenarios":"Registering a window at path \"Tools/MyWin\" first, then later \"Tools/MyWin/Child\" — the leaf 'Tools/MyWin' cannot become a group; registering paths where one is a prefix of the other but the shorter one was taken by a window.","commonSituations":"Incrementally adding nested debugger windows without planning the path tree; renaming a window into what is now a parent path of an existing window.","solutions":["Plan the path hierarchy first: register \"Tools/MyWin/Child\" instead of reusing \"Tools/MyWin\" as both a window and a group.","Unregister the conflicting leaf window before registering the deeper path.","Use distinct group names and leaf names so no path is a prefix of another."],"exampleFix":"// before\ndebugger.RegisterDebuggerWindow(\"Tools/Info\", new InfoWindow());\ndebugger.RegisterDebuggerWindow(\"Tools/Info/Detail\", new DetailWindow()); // conflicts\n// after\ndebugger.RegisterDebuggerWindow(\"Tools/Info/Main\", new InfoWindow());\ndebugger.RegisterDebuggerWindow(\"Tools/Info/Detail\", new DetailWindow());","handlingStrategy":"validation","validationCode":"// before registering \"G/S/W\", ensure no leaf window occupies \"G/S\"\nif (debugger.HasDebuggerWindow(groupPath) && !(debugger.GetDebuggerWindow(groupPath) is DebuggerWindowGroup))\n    debugger.UnregisterDebuggerWindow(groupPath);","typeGuard":"static bool IsGroup(IDebuggerWindow w) => w is DebuggerWindowGroup;","tryCatchPattern":"try { debugger.RegisterDebuggerWindow(path, window); }\ncatch (GameFrameworkException) { Log.Error($\"Path '{path}' hierarchy conflicts with an existing window\"); }","preventionTips":["Design the debugger path tree up front; never use one path as both a window and a group","Keep group prefixes and leaf names disjoint","Check what occupies a parent path before registering deeper paths"],"tags":["debugger","path-conflict","hierarchy","csharp"],"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"}