RegistrationDefaultsAttribute.RegistrationStrategy documents its default as Self:
/// <remarks>
/// Default value is <see cref="RegistrationStrategy.Self"/>.
/// </remarks>
public RegistrationStrategy RegistrationStrategy { get; init; }
The property is an unset init on an enum whose zero value is None, not Self:
public enum RegistrationStrategy
{
None = 0,
Self = 1,
ImplementedInterfaces = 2,
SelfAndImplementedInterfaces = 3,
}
So the actual default is None.
The two are behaviourally equivalent when no ServiceType is given — None is documented as "registers the attributed concrete type as the service provided in ServiceType; or the targeted class otherwise" — so this is an IntelliSense/documentation bug rather than a functional one. But it is misleading in the case that distinguishes them: with a ServiceType present, None defers to ServiceType while Self would not, and the XML doc tells the reader the wrong one is in effect.
Compare DuplicateStrategy on the same type, whose remarks correctly describe the resolution order rather than naming a member.
Suggest matching the wording used on RegisterSingletonAttribute.RegistrationStrategy, which already spells out the fallback chain accurately.
Found while auditing the packages for the docs site rewrite.
RegistrationDefaultsAttribute.RegistrationStrategydocuments its default asSelf:The property is an unset
initon an enum whose zero value isNone, notSelf:So the actual default is
None.The two are behaviourally equivalent when no
ServiceTypeis given —Noneis documented as "registers the attributed concrete type as the service provided inServiceType; or the targeted class otherwise" — so this is an IntelliSense/documentation bug rather than a functional one. But it is misleading in the case that distinguishes them: with aServiceTypepresent,Nonedefers toServiceTypewhileSelfwould not, and the XML doc tells the reader the wrong one is in effect.Compare
DuplicateStrategyon the same type, whose remarks correctly describe the resolution order rather than naming a member.Suggest matching the wording used on
RegisterSingletonAttribute.RegistrationStrategy, which already spells out the fallback chain accurately.Found while auditing the packages for the docs site rewrite.