Problem
A missing/empty BucketName throws a NullReferenceException from the NatsCache constructor (src/NatsDistributedCache/NatsCache.cs). This surfaces as a confusing error at first use rather than a clear configuration failure.
Proposal
Validate options at startup using the options pattern:
services.AddOptions<NatsCacheOptions>()
.Validate(o => !string.IsNullOrWhiteSpace(o.BucketName), "BucketName must be set")
.ValidateOnStart();
(or an IValidateOptions<NatsCacheOptions> implementation). Remove the NullReferenceException throw.
Acceptance criteria
- Empty/whitespace
BucketName fails fast at startup with a descriptive OptionsValidationException.
- No
NullReferenceException path remains.
Good first issue.
Problem
A missing/empty
BucketNamethrows aNullReferenceExceptionfrom theNatsCacheconstructor (src/NatsDistributedCache/NatsCache.cs). This surfaces as a confusing error at first use rather than a clear configuration failure.Proposal
Validate options at startup using the options pattern:
(or an
IValidateOptions<NatsCacheOptions>implementation). Remove theNullReferenceExceptionthrow.Acceptance criteria
BucketNamefails fast at startup with a descriptiveOptionsValidationException.NullReferenceExceptionpath remains.Good first issue.