{"record":{"id":"6c1d1f8a2aaf16ab","repo":"OdysseusYuan/LKY_OfficeTools","slug":"office","errorCode":null,"errorMessage":"Office 信息获取失败！","messagePattern":"Office 信息获取失败！","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"LKY_OfficeTools/Lib/Lib_OfficeInfo.cs","lineNumber":92,"sourceCode":"                            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                            //访问当前网址返回数据为空，或者无法截取获得有效字段时，遍历。\n                            if (try_times < channel_list.Count)\n                            {\n                                new Log($\"     >> 尝试使用 {++try_times} 号服务器获取中 ...\", ConsoleColor.DarkYellow);\n                                continue;\n                            }\n                        }\n\n                        //全部遍历完，依旧没返回，就说明全部失败\n                        throw new Exception(\"Office 信息获取失败！\");\n                    }\n                    catch (Exception Ex)\n                    {\n                        new Log(\"     × 最新 Office 信息获取失败，请稍后重试！\", ConsoleColor.DarkRed);\n                        new Log(Ex.ToString());\n                        return null;\n                    }\n                }\n            }\n\n            private static Version _office_latest_version;\n            internal static Version OfficeLatestVersion\n            {\n                get\n                {\n                    try\n                    {\n                        //非空返回","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/OdysseusYuan/LKY_OfficeTools/blob/6f9a1bd471918f3310e6be4a6d7f42d0d6e467cf/LKY_OfficeTools/Lib/Lib_OfficeInfo.cs#L74-L110","documentation":"Thrown after iterating every URL in the OfficeChannels_Url list and getting null/empty from Com_WebOS.Visit_WebClient for each one. Visit_WebClient returns null on any network or HTTP error (DNS failure, connection refused, timeout, 404/500, TLS handshake failure, proxy rejection). This error therefore means all configured Office channel mirrors are unreachable simultaneously.","triggerScenarios":"Every URL in the semicolon-separated channel_list returns null from Visit_WebClient — e.g. total network outage, all mirror hosts down, all URLs stale/misconfigured, a proxy blocking all CDN domains, or TLS/DNS failure affecting all targets.","commonSituations":"Complete network outage; corporate firewall blocking all Microsoft CDN / Office update domains; all mirror URLs in the config are stale and return 404; DNS resolution failing system-wide; a captive portal intercepting all requests.","solutions":["Confirm overall internet connectivity (e.g. ping a stable host).","Test each channel URL directly in a browser or with curl to see which return content.","If behind a proxy/firewall, whitelist the Office CDN/mirror domains.","Retry after a short wait — transient mirror outages resolve on their own.","Verify the URLs in OfficeChannels_Url are current and not pointing at decommissioned hosts."],"exampleFix":"// before\nforeach (var now_url in channel_list)\n{\n    office_info = Com_WebOS.Visit_WebClient(now_url.Replace(\" \", \"\"));\n    if (!string.IsNullOrEmpty(office_info))\n        return _office_channel_info = office_info;\n    if (try_times < channel_list.Count) { new Log($\">> 尝试 {++try_times} 号服务器...\"); continue; }\n}\nthrow new Exception(\"Office 信息获取失败！\");\n\n// after — add a bounded retry-with-backoff before giving up\nfor (int attempt = 0; attempt < 3; attempt++)\n{\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            return _office_channel_info = office_info;\n    }\n    if (attempt < 2) System.Threading.Thread.Sleep(3000 * (attempt + 1));\n}\nthrow new Exception(\"Office 信息获取失败！所有镜像均不可达，请检查网络。\");","handlingStrategy":"retry","validationCode":"// Optional pre-flight: confirm at least one channel URL is reachable before iterating.\n// (Visit_WebClient has no separate ping, so this is effectively the same call — keep the retry loop instead.)\nnull","typeGuard":null,"tryCatchPattern":"// Retry the full mirror list a few times with backoff before surfacing the error.\nstring office_info = null;\nfor (int attempt = 0; attempt < 3 && office_info == null; attempt++)\n{\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)) break;\n    }\n    if (office_info == null && attempt < 2) System.Threading.Thread.Sleep(3000 * (attempt + 1));\n}\nif (office_info == null)\n    throw new Exception(\"所有 Office 镜像均不可达，请检查网络后重试。\");","preventionTips":["Maintain multiple geographically diverse mirror URLs in OfficeChannels_Url.","Add bounded retry with exponential backoff around the mirror iteration.","Validate each URL format before use; stale URLs silently 404 into null.","Surface which specific URLs failed in the log to aid diagnosis."],"tags":["network","mirror","download","retry","cdn"],"backgroundTag":null,"analyzedSha":"6f9a1bd471918f3310e6be4a6d7f42d0d6e467cf","analyzedAt":"2026-08-13T18:00:34.810Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}