{"record":{"id":"ef78fb9ce3691bb7","repo":"JeffreySu/WeiXinMPSDK","slug":"infotype","errorCode":null,"errorMessage":"未知的InfoType请求类型","messagePattern":"未知的InfoType请求类型","errorType":"exception","errorClass":"UnknownRequestMsgTypeException","httpStatus":null,"severity":"error","filePath":"src/Senparc.Weixin.Open/Senparc.Weixin.Open/MessageHandlers/ThirdPartyMessageHandlerAsync.cs","lineNumber":148,"sourceCode":"                        {\n                            var requestMessage = RequestMessage as RequestMessage3rdWxaWxVerify;\n                            ResponseMessageText = await On3rdWxaWxVerifyRequestAsync(requestMessage, cancellationToken);\n                        }\n                        break;\n                    case RequestInfoType.order_path_apply_result_notify:\n                        {\n                            var requestMessage = RequestMessage as RequestMessageOrderPathApplyResultNotify;\n                            ResponseMessageText = await OnOrderPathApplyResultNotifyRequestAsync(requestMessage, cancellationToken);\n                        }\n                        break;\n                    case RequestInfoType.order_path_audit_result_notify:\n                        {\n                            var requestMessage = RequestMessage as RequestMessageOrderPathAuditResultNotify;\n                            ResponseMessageText = await OnOrderPathAuditResultNotifyRequestAsync(requestMessage, cancellationToken);\n                        }\n                        break;\n                    default:\n                        throw new UnknownRequestMsgTypeException(\"未知的InfoType请求类型\", null);\n                }\n\n            }\n            catch (Exception ex)\n            {\n                throw new MessageHandlerException(\"ThirdPartyMessageHandler中ExecuteAsync()过程发生错误：\" + ex.Message, ex);\n            }\n            finally\n            {\n                await OnExecutedAsync(cancellationToken);\n            }\n        }\n\n        public virtual Task OnExecutingAsync(CancellationToken cancellationToken)\n        {\n            OnExecuting();\n            return Task.CompletedTask;\n        }","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/JeffreySu/WeiXinMPSDK/blob/be573f6f94bdbf718dd5f6cdecb137fbc7ff651e/src/Senparc.Weixin.Open/Senparc.Weixin.Open/MessageHandlers/ThirdPartyMessageHandlerAsync.cs#L130-L166","documentation":"ThirdPartyMessageHandlerAsync.ExecuteAsync switches on the request message's InfoType and throws UnknownRequestMsgTypeException for any InfoType it has no dedicated handler branch for. This means WeChat pushed a third-party-platform event type the library version does not model.","triggerScenarios":"Receiving a WeChat component push (in the authorized-event XML) whose InfoType is not one of the enum values handled in ExecuteAsync's switch — e.g. a newly announced event type your Senparc.Weixin.Open version predates.","commonSituations":"WeChat adds a new InfoType (like newer order/audit notifies) while the installed Senparc.Weixin.Open package is outdated; malformed or unexpected push payloads routed into the handler.","solutions":["Upgrade Senparc.Weixin.Open (and the Senparc.Weixin SDK family) to the latest version so the new InfoType has a request message type and handler branch.","Inspect the raw XML push to identify the unknown InfoType; add custom handling in OnThirdPartyMessageRequestAsync or before ExecuteAsync.","Wrap Execute in try-catch for UnknownRequestMsgTypeException / MessageHandlerException and log the InfoType instead of failing the callback."],"exampleFix":"// before\nawait messageHandler.ExecuteAsync(CancellationToken.None);\n// after\ntry { await messageHandler.ExecuteAsync(CancellationToken.None); }\ncatch (MessageHandlerException ex)\n{\n    logger.LogWarning(ex, \"Unhandled InfoType push: {Xml}\", rawXml);\n    return Content(\"success\");\n}","handlingStrategy":"try-catch","validationCode":"var infoType = doc.Root?.Element(\"InfoType\")?.Value;\nif (!Enum.TryParse<RequestInfoType>(infoType, out _))\n    logger.LogWarning(\"Unknown InfoType push: {InfoType}\", infoType);","typeGuard":"bool IsSupportedInfoType(string infoType) => Enum.IsDefined(typeof(RequestInfoType), infoType);","tryCatchPattern":"try { await messageHandler.ExecuteAsync(ct); }\ncatch (MessageHandlerException ex) when (ex.InnerException is UnknownRequestMsgTypeException)\n{ logger.LogWarning(\"Unhandled InfoType push\"); return Content(\"success\"); }","preventionTips":["Keep Senparc.Weixin.Open updated for new WeChat InfoTypes.","Acknowledge 'success' to WeChat even for unrecognized pushes to avoid retry storms.","Log raw push XML so new event types can be identified and handled quickly."],"tags":["weixin-open","message-handler","unknown-info-type","version-mismatch"],"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"}