-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
features: 请求适配对接Lagrange.Core #117
Comments
对接Lagrange.Core时出现以下错误:
接受消息事件正常,但每一条消息都报出此错误。 |
Lagrange那边给到的问题来源是[ "user_id": -1]这个参数导致的异常 |
猜测仅是猜测,理论上来说,依照 OnebotV11 的相关章节 onebot-11/api/public - send_msg - 发送消息 ,上述接口调用中负载的 Json 内容中当 {
"message_type": "group",
"group_id": 114514,
"message": "哼哼哼啊啊啊啊啊啊",
"auto_escape": false
} 但以上述反馈中所观察到的 Lagrange.Core 日志来看,Lagrange.Core 似乎在这种情形下在尝试读取 Json 的流程中给予了
目前开发组决定进行推进以下措施来改善
目前推荐你进行的举措,优先级依次递减
|
我在测试后发现确实是OlivOS在发送消息时主动带上了user_id=-1的参数 |
我们将启动相关流程进行验证,感谢你的指出 |
问题分析首先要感谢你所提供的新信息,我在查看最新的相关代码并进行测试验证后确认了你所反馈的情况属实。 前面的讨论以及反馈已经确认上述 尽管本问题反映了 Lagrange.Core 对于这种未定义行为目前看来存在一定的兼容性,但考虑到这属于一个程度更轻的由未定义行为引发的兼容性问题,而非某种明确不符合协议的性质,所以我认可由 OlivOS 侧主导本问题的修复对接。 不过在此基础上,我依旧认为 Lagrange.Core 在这种场景下抛出错误并影响业务并非合理设计,主要是因为它不符合向下兼容的设计哲学。 目前开发组决定进行推进以下措施来改善
目前推荐你进行的举措,优先级依次递减
|
需求描述:使用ONEBOT11/HTTP连接Lagrange.Core,接受消息及事件正常,发送消息不兼容出现异常,请求兼容适配

问题截图:
问题日志:info: Lagrange.OneBot.Core.Network.Service.HttpService[0]
Receive(Conn: 814a00bd-af03-42b1-8d26-5bd633ac6dfe: {"action":"send_msg","params":{"message_type": "group", "user_id": -1, "group_id": "473625090", "message": "[桑相]掐指一算: 1D100=14", "auto_escape": false}})
warn: Lagrange.OneBot.Core.Operation.OperationService[0]
Unexpected error encountered while handling message.
System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable
1[System.UInt32]. Path: $.user_id | LineNumber: 0 | BytePositionInLine: 36. ---> System.FormatException: Either the JSON value is not in a supported format, or is out of bounds for a UInt32. at System.Text.Json.ThrowHelper.ThrowFormatException(NumericType numericType) at System.Text.Json.Utf8JsonReader.GetUInt32() at System.Text.Json.Serialization.Converters.NullableConverter
1.ReadNumberWithCustomHandling(Utf8JsonReader& reader, JsonNumberHandling numberHandling, JsonSerializerOptions options)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.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) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) at System.Text.Json.Serialization.JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)at System.Text.Json.Serialization.Metadata.JsonTypeInfo
1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state) at System.Text.Json.JsonSerializer.ReadAsObject(Utf8JsonReader& reader, JsonTypeInfo jsonTypeInfo) at Lagrange.OneBot.Core.Entity.Action.OneBotMessageConverter
4.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)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)at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan
1 utf8Json, JsonTypeInfo
1 jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromNode[TValue](JsonNode node, JsonTypeInfo
1 jsonTypeInfo)at Lagrange.OneBot.Core.Operation.Message.SendMessageOperation.HandleOperation(BotContext context, JsonNode payload)
at Lagrange.OneBot.Core.Operation.OperationService.HandleOperation(MsgRecvEventArgs e)
The text was updated successfully, but these errors were encountered: