I can’t send objects to stream, it gives an error. #298
Unanswered
oneprofittips
asked this question in
Q&A
Replies: 1 comment 1 reply
-
By default AOT friendly serializers are used so it won't work with custom objects. You need define contexts for your objects or use JSON serializer with reflection: Add this Nuget package first:
then change the default serializer: var natsOpts = NatsOpts.Default with { SerializerRegistry = NatsJsonSerializerRegistry.Default };
await using var nats = new NatsConnection(natsOpts); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have this piece of code, and it works if I pass an int string, but if I start passing objects, then an error occurs.
I get this error
What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions