WeiXinMPSDK icon indicating copy to clipboard operation
WeiXinMPSDK copied to clipboard

菜单读取失败

Open peny911 opened this issue 1 year ago • 3 comments

此版块专为反馈 bug 及提交需求服务,不负责解答开发问题,请勿发表开发问题, 如果您需要这方面的帮助,请移步问答社区:https://weixin.senparc.com/QA

问题描述

反馈一个问题,使用 CommonApi.GetMenu(appId) 方法会抛出异常。

通过断点到源码(CommonApis.Menu.CommonApi.Menu.Custom.cs)看到异常位置是: if (jsonResult.menu == null || jsonResult.menu.list == null || jsonResult.menu.list.subbutton.Count == 0) { throw new WeixinMenuException(jsonResult.errmsg); }

实际从微信可以取到菜单: var jsonString = RequestUtility.HttpGet(CommonDI.CommonSP, url, Encoding.UTF8); json格式是: { "menu" : { button: [ { type: "click", name: "单击测试", key: "OneClick", sub_button: [] } ...... ] } }

menu下面没有list而导致抛出异常。

重现问题步骤(如果可以)

20230606160729

20230606143030

微信官方文档 URL
微信官方文档快照(直接复制关键内容到下方)
发现问题的模块
  • [ ] Senparc.Weixin 版本:
  • [x] Senparc.Weixin.MP 版本:16.18.12
  • [ ] Senparc.Weixin.MP.MVC 版本:
  • [ ] Senparc.Weixin.Open 版本: ~- [ ] Senparc.Weixin.QY 版本:~
  • [ ] Senparc.Weixin.Work 版本:
  • [ ] Senparc.Weixin.WxOpen 版本:
  • [ ] Senparc.Weixin.Cache.Redis 版本:
  • [ ] Senparc.Weixin.Cache.Memcached 版本:
  • [ ] Senparc.Weixin.Tenpay 版本:
  • [ ] Senparc.WebSocket 版本:
  • [ ] 其他模块:
模块对应的 .net 版本
  • [ ] .net 3.5
  • [ ] .net 4.0
  • [ ] .net 4.5+
  • [ ] .net standard 2.0 / 2.1
  • [ ] .net core 1.x
  • [ ] .net core 2.x
  • [ ] .net core 3.x
  • [x] .net 5.x / 6.x
开发环境
  • [ ] Visual Studio 2019
  • [x] Visual Studio 2022
  • [ ] Visual Studio Code
  • [ ] 其他:
缓存环境
  • [x] 服务器内存缓存(默认)
  • [ ] Redis 版本:
  • [ ] Memcached 版本:
  • [ ] 其他:
系统环境
  • [x] Windows,版本:
  • [ ] Linux,版本:
  • [ ] Mac,版本:
  • [ ] 其他:
联系方式

Email:[email protected]

(也可将问题地址及联系方式发送到 [email protected]

发布问题后,请保持对 issue 的关注,有时会有需要进一步沟通的信息,很长时间内没有得到答复的 issue 将被关闭。

peny911 avatar Jun 06 '23 08:06 peny911

@JeffreySu 应该和这个fix有关(https://github.com/JeffreySu/WeiXinMPSDK/issues/2804)

peny911 avatar Jun 12 '23 04:06 peny911

好的好的 感谢反馈 我们修复一下~

JaneConan avatar Jun 13 '23 02:06 JaneConan

已经发布新版本:https://www.nuget.org/packages/Senparc.Weixin.MP/16.18.13,谢谢!

JeffreySu avatar Jun 13 '23 15:06 JeffreySu