{"record":{"id":"3246236fc64eab7a","repo":"JeffreySu/WeiXinMPSDK","slug":"weixin-wxopen-advancedapis-templateapi","errorCode":null,"errorMessage":"Weixin.WxOpen.AdvancedAPIs.TemplateApi下调用同名接口！","messagePattern":"Weixin\\.WxOpen\\.AdvancedAPIs\\.TemplateApi下调用同名接口！","errorType":"exception","errorClass":"WeixinObsoleteException","httpStatus":null,"severity":"error","filePath":"src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/Template/TemplateApi.cs","lineNumber":67,"sourceCode":"    public static class TemplateApi\n    {\n        #region 同步方法\n\n\n        #region 模板快速设置\n\n        /// <summary>\n        /// 获取小程序模板库标题列表\n        /// </summary>\n        /// <param name=\"accessToken\">接口调用凭证</param>\n        /// <param name=\"offset\">offset和count用于分页，表示从offset开始，拉取count条记录，offset从0开始，count最大为20。</param>\n        /// <param name=\"count\">offset和count用于分页，表示从offset开始，拉取count条记录，offset从0开始，count最大为20。</param>\n        /// <param name=\"timeOut\">请求超时时间</param>\n        /// <returns></returns>\n        [Obsolete(\"请在小程序模块Senparc.Weixin.WxOpen.AdvancedAPIs.TemplateApi下调用同名接口！\")]\n        public static WxJsonResult LibraryList(string accessToken, int offset, int count, int timeOut = Config.TIME_OUT)\n        {\n          throw new WeixinObsoleteException(\"Weixin.WxOpen.AdvancedAPIs.TemplateApi下调用同名接口！\");\n        }\n\n        /// <summary>\n        /// 获取模板库某个模板标题下关键词库\n        /// </summary>\n        /// <param name=\"accessToken\">接口调用凭证</param>\n        /// <param name=\"id\">模板标题id，可通过接口获取，也可登录小程序后台查看获取</param>\n        /// <param name=\"timeOut\">请求超时时间</param>\n        /// <returns></returns>\n        [Obsolete(\"请在小程序模块Senparc.Weixin.WxOpen.AdvancedAPIs.TemplateApi下调用同名接口！\")]\n        public static WxJsonResult LibraryGet(string accessToken, string id, int timeOut = Config.TIME_OUT)\n        {\n            throw new WeixinObsoleteException(\"Weixin.WxOpen.AdvancedAPIs.TemplateApi下调用同名接口！\");\n        }\n\n\n        /// <summary>\n        /// 组合模板并添加至帐号下的个人模板库","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/JeffreySu/WeiXinMPSDK/blob/be573f6f94bdbf718dd5f6cdecb137fbc7ff651e/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/Template/TemplateApi.cs#L49-L85","documentation":"TemplateApi.LibraryList in Senparc.Weixin.Open's WxaAPIs is a stub: it is marked [Obsolete] and immediately throws WeixinObsoleteException. The real implementation moved to the mini-program module Senparc.Weixin.WxOpen.AdvancedAPIs.TemplateApi.LibraryList.","triggerScenarios":"Calling the old Senparc.Weixin.Open.WxaAPIs.TemplateApi.LibraryList(accessToken, offset, count) — any call throws, there is no working code path.","commonSituations":"Upgrading Senparc.Weixin.Open where the method was gutted; old code samples referencing the Open-module TemplateApi; IDE auto-imports picking the wrong namespace (Open vs WxOpen).","solutions":["Replace the call with Senparc.Weixin.WxOpen.AdvancedAPIs.TemplateApi.LibraryList(accessToken, offset, count, timeOut).","Fully qualify or fix using directives so the WxOpen TemplateApi is imported, not the Open one.","Remove references to the obsolete Open-module template APIs — they will always throw."],"exampleFix":"// before\nvar list = Senparc.Weixin.Open.WxaAPIs.TemplateApi.LibraryList(accessToken, 0, 20);\n// after\nvar list = Senparc.Weixin.WxOpen.AdvancedAPIs.TemplateApi.LibraryList(accessToken, 0, 20);","handlingStrategy":"validation","validationCode":"var flags = typeof(Senparc.Weixin.Open.WxaAPIs.TemplateApi)\n    .GetMethod(nameof(Senparc.Weixin.Open.WxaAPIs.TemplateApi.LibraryList))?\n    .GetCustomAttributes(typeof(ObsoleteAttribute), false);\nbool isObsoleteStub = flags != null && flags.Length > 0; // use WxOpen module instead","typeGuard":null,"tryCatchPattern":"try { var r = Open.WxaAPIs.TemplateApi.LibraryList(token, 0, 20); }\ncatch (WeixinObsoleteException) { r = WxOpen.AdvancedAPIs.TemplateApi.LibraryList(token, 0, 20); }","preventionTips":["Treat Obsolete warnings as errors (TreatWarningsAsErrors) so stubs are caught at compile time.","Import Senparc.Weixin.WxOpen.AdvancedAPIs explicitly; avoid blanket namespace imports.","Migrate all mini-program template calls to the WxOpen module once, project-wide."],"tags":["weixin-open","obsolete-api","template-api","migration"],"backgroundTag":"deprecated-api-usage","analyzedSha":"be573f6f94bdbf718dd5f6cdecb137fbc7ff651e","analyzedAt":"2026-09-12T10:01:50.733Z","contentChangedAt":"2026-09-12T10:01:50.733Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}