{"record":{"id":"52f329fed96f066a","repo":"EllanJiang/GameFramework","slug":"path-is-invalid","errorCode":null,"errorMessage":"Path is invalid.","messagePattern":"Path is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs","lineNumber":211,"sourceCode":"                DebuggerWindowGroup debuggerWindowGroup = (DebuggerWindowGroup)InternalGetDebuggerWindow(debuggerWindowGroupName);\n                if (debuggerWindowGroup == null || !InternalSelectDebuggerWindow(debuggerWindowGroupName))\n                {\n                    return false;\n                }\n\n                return debuggerWindowGroup.SelectDebuggerWindow(leftPath);\n            }\n\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);","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Debugger/DebuggerManager.DebuggerWindowGroup.cs#L193-L229","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-empty path containing at least a window name, e.g. \"System/MyWindow\".","Null/empty-check the path before calling RegisterDebuggerWindow.","If building paths dynamically, validate the source value before formatting."],"exampleFix":"// before\nstring path = config.WindowPath; // may be empty\ndebugger.RegisterDebuggerWindow(path, new MyWindow());\n// after\nif (!string.IsNullOrEmpty(config.WindowPath))\n    debugger.RegisterDebuggerWindow(config.WindowPath, new MyWindow());","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(path)) path = \"Default/Window\";","typeGuard":"static bool IsValidDebuggerPath(string p) => !string.IsNullOrEmpty(p);","tryCatchPattern":"try { group.RegisterDebuggerWindow(path, window); }\ncatch (GameFrameworkException ex) { Log.Error($\"Debugger registration failed: {ex.Message}\"); }","preventionTips":["Define debugger paths as non-empty constants","Validate config/inspector path fields at load time","Never build paths from unvalidated user/config input"],"tags":["debugger","path","validation","csharp"],"backgroundTag":"empty-required-field","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"}