Skip to content

XML doc on RegistrationDefaultsAttribute.RegistrationStrategy claims the default is Self; it is None #60

Description

@dukesteen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions