Summary
Two usability defects in SqlServiceBrokerOptionsBuilder (src/Chatter.MessageBrokers.SqlServiceBroker/src/Chatter.MessageBrokers.SqlServiceBroker/Configuration/SqlServiceBrokerOptionsBuilder.cs). Found while rewriting the module README (branch docs/readme-overhaul); the README tells readers to call an AddSqlServiceBrokerOptions overload first.
1. With* methods throw NullReferenceException before an AddSqlServiceBrokerOptions overload
_sqlServiceBrokerOptions is only assigned inside the AddSqlServiceBrokerOptions overloads (:19, :25, :38). WithConnectionString (:53-57) and the other With* setters dereference it directly, so calling them first throws NullReferenceException. Meanwhile the Build() error message (:144-149) says "Use an overload of AddSqlServiceBrokerOptions or WithConnectionString to configure SqlServiceBrokerOptions", which suggests WithConnectionString alone is enough.
Fix options: initialise a default options instance so WithConnectionString works on its own, or throw a clear InvalidOperationException and correct the Build() message.
2. Compression cannot be turned off through the fluent API
WithMessageBodyCompression() (:117-121) sets CompressMessageBody = true, which is already the default. There is no fluent way to disable compression; you have to pass compressMessageBody: false to an AddSqlServiceBrokerOptions overload. Consider WithMessageBodyCompression(bool enabled = true) or a WithoutMessageBodyCompression() counterpart.
Impact
Low: developer-experience traps, no runtime data impact.
Summary
Two usability defects in
SqlServiceBrokerOptionsBuilder(src/Chatter.MessageBrokers.SqlServiceBroker/src/Chatter.MessageBrokers.SqlServiceBroker/Configuration/SqlServiceBrokerOptionsBuilder.cs). Found while rewriting the module README (branchdocs/readme-overhaul); the README tells readers to call anAddSqlServiceBrokerOptionsoverload first.1.
With*methods throwNullReferenceExceptionbefore anAddSqlServiceBrokerOptionsoverload_sqlServiceBrokerOptionsis only assigned inside theAddSqlServiceBrokerOptionsoverloads (:19,:25,:38).WithConnectionString(:53-57) and the otherWith*setters dereference it directly, so calling them first throwsNullReferenceException. Meanwhile theBuild()error message (:144-149) says "Use an overload of AddSqlServiceBrokerOptions or WithConnectionString to configure SqlServiceBrokerOptions", which suggestsWithConnectionStringalone is enough.Fix options: initialise a default options instance so
WithConnectionStringworks on its own, or throw a clearInvalidOperationExceptionand correct theBuild()message.2. Compression cannot be turned off through the fluent API
WithMessageBodyCompression()(:117-121) setsCompressMessageBody = true, which is already the default. There is no fluent way to disable compression; you have to passcompressMessageBody: falseto anAddSqlServiceBrokerOptionsoverload. ConsiderWithMessageBodyCompression(bool enabled = true)or aWithoutMessageBodyCompression()counterpart.Impact
Low: developer-experience traps, no runtime data impact.