fudiwei / DotNetCore.SKIT.FlurlHttpClient.Wechat

可能是全网最完整的 C# 版微信 SDK,封装全部已知的微信 OpenAPI,包含微信公众平台(订阅号+服务号+小程序+小游戏+小商店+视频号)、微信开放平台、微信商户平台(微信支付+微企付)、企业微信、微信广告平台、微信智能对话开放平台等模块,可跨平台。持续随官方更新,欢迎 Star/Fork/PR。QQ 交流群 875580418【满】、930461548【满】、611974621。
https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient
MIT License
1.47k stars 285 forks source link

[BUG] ExecuteCgibinFreePublishSubmitAsync 解析返回数据的json格式报错了 #136

Closed DinnerGit closed 4 months ago

DinnerGit commented 4 months ago

⚠⚠ 请注意:不符合格式要求的 Issue 可能会被直接关闭。


关于问题的简单描述

ExecuteCgibinFreePublishSubmitAsync 解析返回数据的json格式报错了


与问题相关的源代码

var response = await _client.ExecuteCgibinFreePublishSubmitAsync(request);

异常堆栈或异常原因

  SKIT.FlurlHttpClient.CommonSerializationException: The JSON value could not be converted to System.String. Path: $.msg_data_id | LineNumber: 0 | BytePositionInLine: 75.
   ---> System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.msg_data_id | LineNumber: 0 | BytePositionInLine: 75.
   ---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
     at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
     at System.Text.Json.Utf8JsonReader.GetString()
     at System.Text.Json.Serialization.Converters.StringConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
     at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
     at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
     at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
     at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)

发生问题的运行环境

请在此填写以下几项内容:

  1. 操作系统:请填写发生问题的操作系统环境信息(如:Windows Server 2012 R2)
  2. .NET 版本:请填写发生问题的 .NET 环境信息(如:.NET Framework 4.7.2 / .NET 5.0)
  3. 使用的模块及版本:请填写发生问题的模块信息(如:SKIT.FlurlHttpClient.Wechat.Api 1.0.0)
  4. 其他环境信息。

补充说明

请在此填写任何其他可以定位问题的信息。

fudiwei commented 4 months ago

可以暂时先指定 JSON 序列化器为 Newtonsoft.Json 规避此错误。后面我会修复此问题。

fudiwei commented 4 months ago

已修复。将随下一版本 release,敬请留意。