blockfrost / blockfrost-dotnet

.NET, C# and PowerShell SDK for Blockfrost.io API
Apache License 2.0
17 stars 9 forks source link

[Bug]: Blockfrost.Api.ApiException: Could not deserialize the response body stream as Blockfrost.Api.Account #63

Closed aleincsharp closed 1 year ago

aleincsharp commented 2 years ago

Contact Details

No response

What happened?

Can not execute "await _accountService.GetAccountsAsync("stake1...");" - getting this error.

Version: 1.0.1+d07cc952045cde7320470268a6cd0f2d22716457

Version

1.0.1+d07cc952045cde7320470268a6cd0f2d22716457

In what OS are you experiencing the problem?

Windows

What version of dotnet are you using?

6.0.x

Relevant log output

HTTP Response: 

Blockfrost.Api.ApiException: Could not deserialize the response body stream as Blockfrost.Api.Account.

Status: 200
Response: 

 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.active_epoch | LineNumber: 0 | BytePositionInLine: 113.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
   at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)
   at System.Text.Json.Utf8JsonReader.GetInt32()
   at System.Text.Json.Serialization.Converters.Int32Converter.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)
   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.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.ReadAllAsync[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsyncCore[T](HttpContent content, Encoding sourceEncoding, JsonSerializerOptions options, CancellationToken cancellationToken)
   at Blockfrost.Api.ABlockfrostService.ReadObjectResponseAsync[T](HttpResponseMessage response, IReadOnlyDictionary`2 headers, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Blockfrost.Api.ABlockfrostService.ReadObjectResponseAsync[T](HttpResponseMessage response, IReadOnlyDictionary`2 headers, CancellationToken cancellationToken)
   at Blockfrost.Api.ABlockfrostService.ReadResponseAsync[TResponse](HttpResponseMessage response, Dictionary`2 headers, CancellationToken cancellationToken)
   at Blockfrost.Api.ABlockfrostService.SendRequestAsync[TResponse](StringBuilder builder, HttpRequestMessage request, CancellationToken cancellationToken)
   at Blockfrost.Api.ABlockfrostService.SendGetRequestAsync[TResponse](StringBuilder builder, CancellationToken cancellationToken)

HEADERS
=======
Accept: */*
Host: localhost:7094
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.42
:method: POST
Accept-Encoding: gzip, deflate, br
Accept-Language: de,de-DE;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,ru;q=0.5
Content-Type: application/json