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

PingAsync() throws AggregateException with 2.0.0 #82

Open
boennhoff opened this issue Oct 11, 2024 · 0 comments
Open

PingAsync() throws AggregateException with 2.0.0 #82

boennhoff opened this issue Oct 11, 2024 · 0 comments

Comments

@boennhoff
Copy link

boennhoff commented Oct 11, 2024

Using B1Slayer 2.0.0 I get an AggregateException when trying to PingAsync(). No matter if using v1 or v2. Looks like the deserialization of the Unix timestamp string to Decimal does not work as expected. Probably System.Text.Json is stricter here than Json.NET was.

Response from ServiceLayer

{
  "message": "pong",
  "sender": "load balancer",
  "timestamp": "1728659370.862"
}

Exception

System.AggregateException: One or more errors occurred. (Response could not be deserialized to JSON: GET https://localhost:50000/ping/)
 ---> Flurl.Http.FlurlParsingException: Response could not be deserialized to JSON: GET https://localhost:50000/ping/
 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Decimal. Path: $.timestamp | LineNumber: 0 | BytePositionInLine: 75.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number.

Stack Trace: 
ThrowHelper.ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
Utf8JsonReader.TryGetDecimal(Decimal& value)
Utf8JsonReader.GetDecimal()
JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
JsonTypeInfo`1.Deserialize(Stream utf8Json)
DefaultJsonSerializer.Deserialize[T](Stream stream)
FlurlResponse.GetJsonAsync[T]()
--- End of inner exception stack trace ---
SLConnection.ExecutePingAsync(String path)
SLConnection.PingAsync()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant