{"record":{"id":"6573af12032359e2","repo":"JeffreySu/WeiXinMPSDK","slug":"irequestmessagelink","errorCode":null,"errorMessage":"微信企业号不支持 IRequestMessageLink 请求类型","messagePattern":"微信企业号不支持 IRequestMessageLink 请求类型","errorType":"exception","errorClass":"MessageHandlerException","httpStatus":null,"severity":"error","filePath":"src/Senparc.Weixin.Work/Senparc.Weixin.Work/MessageHandlers/WorkMessageEntityEnlightener.cs","lineNumber":36,"sourceCode":"\n        public override IRequestMessageEvent NewRequestMessageEvent()\n        {\n            return new RequestMessageEventBase();\n        }\n\n        public override IRequestMessageFile NewRequestMessageFile()\n        {\n            return new RequestMessageFile();\n        }\n\n        public override IRequestMessageImage NewRequestMessageImage()\n        {\n            return new RequestMessageImage();\n        }\n\n        public override IRequestMessageLink NewRequestMessageLink()\n        {\n            throw new MessageHandlerException(\"微信企业号不支持 IRequestMessageLink 请求类型\");\n        }\n\n        public override IRequestMessageLocation NewRequestMessageLocation()\n        {\n            return new RequestMessageLocation();\n        }\n\n        public override IRequestMessageShortVideo NewRequestMessageShortVideo()\n        {\n            return new RequestMessageShortVideo();\n        }\n\n        public override IRequestMessageText NewRequestMessageText()\n        {\n            return new RequestMessageText();\n        }\n\n        public override IRequestMessageVideo NewRequestMessageVideo()","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/JeffreySu/WeiXinMPSDK/blob/be573f6f94bdbf718dd5f6cdecb137fbc7ff651e/src/Senparc.Weixin.Work/Senparc.Weixin.Work/MessageHandlers/WorkMessageEntityEnlightener.cs#L18-L54","documentation":"WorkMessageEntityEnlightener.NewRequestMessageLink creates new entity instances for the message-handler pipeline; the Work (WeCom) platform has no link-type request message, so this method always throws MessageHandlerException instead of returning an entity. It is an intentional capability marker, not a runtime fault.","triggerScenarios":"Code explicitly calls NewRequestMessageLink() on a Work message handler's enlightener, or generic message-handler code that iterates all message types (e.g. copying entities, reflection-based pipelines, shared MP code paths) invokes it.","commonSituations":"Porting MP (Official Account) handler code that references link messages to the Work platform; generic test harnesses instantiating every request entity type; reflection-driven code that enumerates NewRequestMessage* methods.","solutions":["Remove code paths that create IRequestMessageLink entities for the Work platform — WeCom callbacks never produce link messages","Guard the call with a platform check (RequestMsgType) or a try-catch for MessageHandlerException if running shared code","Skip link-message handling in generic pipelines when the target platform is Work"],"exampleFix":"// before\nvar link = enlightener.NewRequestMessageLink();\n// after\nif (postModel.Platform != PlatformType.WeWork) { var link = enlightener.NewRequestMessageLink(); }","handlingStrategy":"validation","validationCode":"if (platform == PlatformType.WeWork) { throw new InvalidOperationException(\"Link messages are not supported on WeCom\"); } var link = enlightener.NewRequestMessageLink();","typeGuard":"bool SupportsLinkMessages(MessageHandlerEntityEnlightener e) => !(e is WorkMessageEntityEnlightener);","tryCatchPattern":null,"preventionTips":["Never call NewRequestMessageLink in code shared with the Work platform","Check the target platform before invoking generic entity factories","Treat link messages as MP-only in cross-platform pipelines"],"tags":["wechat-work","link-message","not-supported"],"backgroundTag":"unsupported-operation","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"}