{"record":{"id":"9efb51b544caed41","repo":"OdysseusYuan/LKY_OfficeTools","slug":"officechannels-url","errorCode":null,"errorMessage":"OfficeChannels_Url 信息获取失败！","messagePattern":"OfficeChannels_Url 信息获取失败！","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"LKY_OfficeTools/Lib/Lib_OfficeInfo.cs","lineNumber":65,"sourceCode":"            internal static string OfficeChannelInfo\n            {\n                get\n                {\n                    try\n                    {\n                        //私有值非空判断\n                        if (!string.IsNullOrWhiteSpace(_office_channel_info))\n                        {\n                            return _office_channel_info;\n                        }\n\n                        new Log(\"\\n------> 正在获取 最新可用 Office 信息 ...\", ConsoleColor.DarkCyan);\n\n                        //获取频道信息，得到可用 Url 列表\n                        string channel_info = Com_TextOS.GetCenterText(AppJson.Info, \"\\\"OfficeChannels_Url\\\": \\\"\", \"\\\"\");\n                        if (string.IsNullOrEmpty(channel_info))\n                        {\n                            throw new Exception(\"OfficeChannels_Url 信息获取失败！\");\n                        }\n                        List<string> channel_list = channel_info.Split(';').ToList();\n\n                        //遍历获取有效地址，并下载channel信息\n                        string office_info = null;\n                        int try_times = 1;                                                          //尝试获取次数，初始值为1\n                        foreach (var now_url in channel_list)\n                        {\n                            office_info = Com_WebOS.Visit_WebClient(now_url.Replace(\" \", \"\"));      //替换网址空格，并获得当前网址的访问信息\n                            if (!string.IsNullOrEmpty(office_info))\n                            {\n                                new Log($\"     √ 已获得 Office 最新正版信息。\", ConsoleColor.DarkGreen);\n\n                                //info有值，返回该值。\n                                return _office_channel_info = office_info;\n                            }\n\n                            //访问当前网址返回数据为空，或者无法截取获得有效字段时，遍历。","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/OdysseusYuan/LKY_OfficeTools/blob/6f9a1bd471918f3310e6be4a6d7f42d0d6e467cf/LKY_OfficeTools/Lib/Lib_OfficeInfo.cs#L47-L83","documentation":"Thrown when the OfficeChannels_Url field cannot be extracted from AppJson.Info via Com_TextOS.GetCenterText. AppJson.Info is downloaded from a Gitee-hosted JSON release file and returns null on any network or HTTP failure. GetCenterText returns empty when its input is null or when the left/right markers are not found. So this fires either because AppJson.Info is null (network/Gitee unreachable) or because the JSON schema no longer contains the OfficeChannels_Url field in the expected format.","triggerScenarios":"AppJson.Info is null because Com_WebOS.Visit_WebClient failed to fetch the Gitee JSON (DNS error, connection refused, HTTP non-2xx, TLS failure, proxy block), OR the JSON was fetched but does not contain the marker `\"OfficeChannels_Url\": \"` ... `\"` in the expected quoting/spacing.","commonSituations":"No internet connection; Gitee is blocked or rate-limited; corporate firewall/proxy intercepts the request; the upstream JSON schema changed and dropped or renamed OfficeChannels_Url; the field's quoting changed (e.g., no space after colon).","solutions":["Verify internet connectivity and that the Gitee release URL in Lib_AppInfo.cs is reachable from a browser.","Inspect AppJson.Info content — if it is non-null but lacks OfficeChannels_Url, the upstream JSON schema changed; update the marker strings.","Confirm the field uses the exact format `\"OfficeChannels_Url\": \"url1;url2\"` including the space after the colon.","If behind a proxy, ensure WebClient picks up the system proxy / DefaultCredentials correctly.","Retry after confirming Gitee is not rate-limiting the release download."],"exampleFix":"// before\nstring channel_info = Com_TextOS.GetCenterText(AppJson.Info, \"\\\"OfficeChannels_Url\\\": \\\"\", \"\\\"\");\nif (string.IsNullOrEmpty(channel_info))\n{\n    throw new Exception(\"OfficeChannels_Url 信息获取失败！\");\n}\n\n// after — separate network failure from schema mismatch\nif (string.IsNullOrEmpty(AppJson.Info))\n{\n    throw new Exception(\"AppJson.Info 为空，请检查网络或 Gitee 可达性。\");\n}\nstring channel_info = Com_TextOS.GetCenterText(AppJson.Info, \"\\\"OfficeChannels_Url\\\": \\\"\", \"\\\"\");\nif (string.IsNullOrEmpty(channel_info))\n{\n    throw new Exception(\"AppJson 中缺少 OfficeChannels_Url 字段，请检查 JSON 格式是否变更。\");\n}","handlingStrategy":"validation","validationCode":"// Check AppJson.Info before extracting channel URLs.\nif (string.IsNullOrEmpty(AppJson.Info))\n{\n    new Log(\"AppJson.Info 获取失败，请检查网络与 Gitee 可达性。\", ConsoleColor.DarkRed);\n    return;\n}\nstring channel_info = Com_TextOS.GetCenterText(AppJson.Info, \"\\\"OfficeChannels_Url\\\": \\\"\", \"\\\"\");\nif (string.IsNullOrEmpty(channel_info))\n{\n    new Log(\"AppJson 中缺少 OfficeChannels_Url 字段，JSON 格式可能已变更。\", ConsoleColor.DarkRed);\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard AppJson.Info with a null check before any GetCenterText call to distinguish network failure from schema drift.","Pin and document the expected AppJson schema; alert on field changes.","Add a connectivity health check for the Gitee release URL before the config fetch.","Keep GetCenterText markers versioned alongside a sample of the expected JSON in tests."],"tags":["network","config","json-parsing","gitee","fragile-parsing"],"backgroundTag":null,"analyzedSha":"6f9a1bd471918f3310e6be4a6d7f42d0d6e467cf","analyzedAt":"2026-08-13T18:00:34.810Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}