Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ошибка получения payload через BotsLongPoolHistory #1586

Open
1 of 3 tasks
Victor564d opened this issue Sep 7, 2023 · 1 comment
Open
1 of 3 tasks
Labels
Ошибка В существующем функционале есть проблема
Milestone

Comments

@Victor564d
Copy link

Victor564d commented Sep 7, 2023

  1. Target для .NET используемый в проекте: (Официально поддерживаем , .net 4.5, NETStandard2.0) (поставьте 'x' в квадратных скобках)
  • .net 4.5
  • NETStandard2.0
  • [] другое. Указать строкой ниже.
  • .net 7
  1. Класс и метод в котором возникла проблема: Newtonsoft.Json ( Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path 'payload', line 5, position 14.
    at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
    at Newtonsoft.Json.JsonTextReader.ReadAsString()
    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
    at VkNet.Utils.JsonConverter.GroupUpdateJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
    at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
    at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings))

  2. Пример кода для воспроизведения проблемы, пожалуйста указавыйте конкретные значения параметров запроса:

  var temp =  api.Groups.GetLongPollServer(222432549);


BotsLongPollHistoryResponse CallBackResponse = api.Groups.GetBotsLongPollHistory(new BotsLongPollHistoryParams
    { 
    	Key = temp.Key,
        Server = temp.Server,
        Ts = temp.Ts,
    });  
                   
  1. JSON ответа
{
  "response": {
  "ts": "105",
  "updates": [
    {
      "group_id": 222432549,
      "type": "message_event",
      "event_id": "4ee38deb506d39e8170bc7e3ad3a6da21a7e8391",
      "v": "5.131",
      "object": {
        "user_id": 138609739,
        "peer_id": 138609739,
        "event_id": "30522b5c2379",
        "payload": []
      }
    }
  ]
}
}
@ivanmem
Copy link
Contributor

ivanmem commented Sep 10, 2023

var a = Regex.Replace(response.ToString(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");

возможно править надо эту регулярку.
@Panuchi глянешь?

@inyutin-maxim inyutin-maxim added this to the v1.77.0 milestone Sep 11, 2023
@inyutin-maxim inyutin-maxim added the Ошибка В существующем функционале есть проблема label Sep 11, 2023
@inyutin-maxim inyutin-maxim modified the milestones: v1.77.0, v1.78.0 Nov 24, 2023
@inyutin-maxim inyutin-maxim modified the milestones: v1.78.0, v1.79.0 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ошибка В существующем функционале есть проблема
Projects
None yet
Development

No branches or pull requests

3 participants