{"record":{"id":"3a9e7f37ab6a8c93","repo":"JeffreySu/WeiXinMPSDK","slug":"commonapi-menu-common","errorCode":null,"errorMessage":"菜单类型无法处理（二级菜单）：","messagePattern":"菜单类型无法处理（二级菜单）：","errorType":"exception","errorClass":"WeixinMenuException","httpStatus":null,"severity":"error","filePath":"src/Senparc.Weixin.MP/Senparc.Weixin.MP/CommonAPIs/Menu/CommonApi.Menu.Common.cs","lineNumber":407,"sourceCode":"                            {\n                                name = subSubButton.name,\n                                article_id = subSubButton.article_id,\n                                type = subSubButton.type\n                            });\n                        }\n                        else if (subSubButton.type.Equals(\"ARTICLE_VIEW_LIMITED\", StringComparison.OrdinalIgnoreCase))\n                        {\n                            //article_view_limited 按钮\n                            subButton.sub_button.Add(new SingleArticleViewLimitedButton()\n                            {\n                                name = subSubButton.name,\n                                article_id = subSubButton.article_id,\n                                type = subSubButton.type\n                            });\n                        }\n                        else\n                        {\n                            throw new WeixinMenuException(\"菜单类型无法处理（二级菜单）：\" + subSubButton.type);\n                        }\n                    }\n                }\n            }\n        }\n\n        /// <summary>\n        /// 根据微信返回的Json数据得到可用的GetMenuResult结果\n        /// </summary>\n        /// <param name=\"resultFull\"></param>\n        /// <param name=\"buttonGroupBase\">ButtonGroupBase的衍生类型，可以为ButtonGroup或ConditionalButtonGroup。返回的GetMenuResult中的menu属性即为此示例。</param>\n        /// <returns></returns>\n        public static GetMenuResult GetMenuFromJsonResult(GetMenuResultFull resultFull, ButtonGroupBase buttonGroupBase)\n        {\n            GetMenuResult result = null;\n            if (buttonGroupBase == null)\n            {\n                throw new ArgumentNullException(\"buttonGroupBase不可以为空！\");","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/JeffreySu/WeiXinMPSDK/blob/be573f6f94bdbf718dd5f6cdecb137fbc7ff651e/src/Senparc.Weixin.MP/Senparc.Weixin.MP/CommonAPIs/Menu/CommonApi.Menu.Common.cs#L389-L425","documentation":"When iterating second-level buttons, any sub_button whose type is not one of the handled values causes WeixinMenuException '菜单类型无法处理（二级菜单）：{type}'. Note the message in the SOURCE concatenates the type, so the runtime message includes the offending value.","triggerScenarios":"A menu's sub_button list contains a type unrecognized by the current SDK version, typically a Weixin menu type introduced after the installed library release.","commonSituations":"Outdated Senparc.Weixin.MP package encountering newer menu types; hand-edited or third-party-generated menu JSON with invalid type strings.","solutions":["Upgrade Senparc.Weixin.MP to the newest release","Identify the unsupported type from the exception message and correct or remove that sub_button in the menu definition","Catch and log WeixinMenuException to capture the offending type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"foreach (var sub in btn.sub_button ?? Array.Empty<SubMenuJson>())\n    if (!supportedTypes.Contains(sub.type?.ToLower()))\n        throw new NotSupportedException($\"Unsupported sub-button type: {sub.type}\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var menu = CommonApi.GetMenu(appId);\n}\ncatch (WeixinMenuException ex) when (ex.Message.StartsWith(\"菜单类型无法处理（二级菜单）\"))\n{\n    logger.LogWarning(ex, \"Unsupported second-level menu type\");\n}","preventionTips":["Upgrade the SDK before using newly announced Weixin menu types","Whitelist known types in your menu editor UI","Test menu parsing against menus fetched from production","Capture the offending type from the exception message in logs"],"tags":["weixin","menu","unsupported-type"],"backgroundTag":"unsupported-enum-value","analyzedSha":"be573f6f94bdbf718dd5f6cdecb137fbc7ff651e","analyzedAt":"2026-09-12T10:01:50.733Z","contentChangedAt":"2026-09-12T10:01:50.733Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}