question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message-associated Metadata Values are now of type JsonElement after v5 update

See original GitHub issue

Hey! It’s me again (:

Just stumbled upon a bug in the library, which was introduced with v5. I assume this is related to the migration from Newtonsoft.Json to System.Text.Json.

Despite Messages/SyncRequests Metadata being of type Dictionary<string, object>, these objects actually seem to be JsonElements.

While previously we could simply cast them to the desired type straight away (for example using (string)), we are now forced to cast them to JsonElement first, then to do something like .GetString() if we are expecting a string:

string commandName = ((JsonElement)message.Metadata["cmd"]).GetString()!;

I doubt this is intended (since it didn’t work that way before the migration), and if it is then it surely would be clearer to have them as JsonElement straight away, instead of object.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jchristncommented, Nov 29, 2022

Likewise Matt, much appreciated! Cheers

1reaction
Laiteuxcommented, Nov 29, 2022

Sounds good to me.

Well, I guess we’re (finally) done then!

Thanks a ton for your work on all of this, Joel. It was a pleasure (:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reactive Messaging RabbitMQ Connector Reference ...
The connector converts incoming RabbitMQ Messages into Reactive Messaging Message<T> instances. The payload type T depends on the value of the RabbitMQ received ......
Read more >
RabbitMQ - SmallRye Reactive Messaging
The connector converts incoming RabbitMQ Messages into Reactive Messaging Message<T> instances. The payload type T depends on the value of the RabbitMQ received ......
Read more >
data-specification/hapi-dev/HAPI-data-access-spec- ...
Server attributes are described using keyword-value pairs, with the required and optional keywords described in the following table. About Object. Name, Type ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found