You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
causes a null reference error when adding the said stream with the sources with IJetstreamManagement.AddStream method. Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at NATS.Client.JetStream.Source.ToJsonNode() at NATS.Client.JetStream.StreamConfiguration.ToJsonNode() at NATS.Client.JetStream.JsonSerializable.Serialize() at NATS.Client.JetStream.JetStreamManagement.AddOrUpdateStream(StreamConfiguration config, String addUpdateTemplate) at NATS.Client.JetStream.JetStreamManagement.AddStream(StreamConfiguration config)
This forces me to supply WithExternal even if the source is not external. Tried these two ways without any success as it still becomes an external source and wont function properly. However the stream does get created. .WithExternal(new External("", "")) and .WithExternal(new External(null, null))
Expected result:
If the expected result would follow the same behavior as for example Stream Configuration builder, the expected result should create a stream, even if WithExternal is not supplied, and result in a similar output (sources is the only important sections in this context) when running for example, nats stream info --json.
When using nats.net user is forced to supply all properties including external, leaving the user with no way to create a source without the external property.
Supplying .WithExternal(new External("", "")) or .WithExternal(new External(null, null)) instead creates a stream without a working source that makes the nats stream info --json look like this:
Thank you for the complete bug report, this is just a bug, you are using it correct. I fixed it here, nats-io/nats.net#663 and checked the external object before trying to add it to the json. I will make a pre-release as soon as this is merged since I don't want to do a full release until I finish something else I'm working on, but it should only be a few more days.
Defect
Make sure that these boxes are checked before submitting your issue -- thank you!
Versions of
NATS.Client
andnats-server
:OS/Container environment:
Steps or code to reproduce the issue:
Using NATS.Client, build two streams, one with the first stream as source but do not add WithExternal to the source like so:
causes a null reference error when adding the said stream with the sources with IJetstreamManagement.AddStream method.
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at NATS.Client.JetStream.Source.ToJsonNode() at NATS.Client.JetStream.StreamConfiguration.ToJsonNode() at NATS.Client.JetStream.JsonSerializable.Serialize() at NATS.Client.JetStream.JetStreamManagement.AddOrUpdateStream(StreamConfiguration config, String addUpdateTemplate) at NATS.Client.JetStream.JetStreamManagement.AddStream(StreamConfiguration config)
This forces me to supply WithExternal even if the source is not external. Tried these two ways without any success as it still becomes an external source and wont function properly. However the stream does get created.
.WithExternal(new External("", ""))
and.WithExternal(new External(null, null))
Expected result:
If the expected result would follow the same behavior as for example Stream Configuration builder, the expected result should create a stream, even if WithExternal is not supplied, and result in a similar output (sources is the only important sections in this context) when running for example,
nats stream info --json
.Actual result:
When using nats.net user is forced to supply all properties including external, leaving the user with no way to create a source without the external property.
Supplying
.WithExternal(new External("", ""))
or.WithExternal(new External(null, null))
instead creates a stream without a working source that makes thenats stream info --json
look like this:This means there is no way for me to create a working source without it being external? Maybe I'm just using it in a wrong way.
The text was updated successfully, but these errors were encountered: