dotnet / dotNext

Next generation API for .NET
https://dotnet.github.io/dotNext/
MIT License
1.62k stars 121 forks source link

IClusterMember::GetMetadataAsync throwing exceptions when used with IRaftHttpCluster #92

Closed Arkensor closed 2 years ago

Arkensor commented 2 years ago

Hi,

I am currently trying to use the Raft feature, and got members to join a cluster. However when I try to get their metadata via GetMetadataAsync the receiving instance (who is also the leader) just throws a middleware exception about not being able to properly handle the json data that is used internally to communicate.

I have tried setting no meta data, I have tried setting a simple "hello" -> "world" pair, nothing seems to make a difference.

Can someone please check if this function is currently working for them? I am using the latest stable release 4.1.3

Thank you!

This is all the information given to me. Visual studio is unable to catch the error, there is no more output besides this:

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.InvalidCastException: Unable to cast object of type 'System.Text.Json.Serialization.Converters.ObjectConverter' to type 'System.Text.Json.Serialization.JsonConverter`1[System.String]'.
         at System.Text.Json.Serialization.JsonDictionaryConverter`3.GetConverter[T](JsonTypeInfo typeInfo)
         at System.Text.Json.Serialization.Converters.DictionaryDefaultConverter`3.OnWriteResume(Utf8JsonWriter writer, TDictionary value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonDictionaryConverter`3.OnTryWrite(Utf8JsonWriter writer, TDictionary dictionary, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.Converters.JsonMetadataServicesConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.JsonSerializer.WriteCore[TValue](JsonConverter jsonConverter, Utf8JsonWriter writer, TValue& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
sakno commented 2 years ago

@Arkensor , thanks for reporting! The fix is already in develop branch.

Arkensor commented 2 years ago

Hello @sakno,

thank you for your quick reply! Great news knowing you could fix it. Do you know when this will be released via nuget? Is there some regular release period?

sakno commented 2 years ago

There is no period for regular releases. I expect to release it in this month to include other fixes.