Skip to content

Consider registering the authentication state provider conditionally #41235

@javiercn

Description

@javiercn

Use TryAddScoped here instead of AddScoped

services.AddScoped<AuthenticationStateProvider, ServerAuthenticationStateProvider>();

It's not clear to me why we do this, but I suspect that it is because in the past we might have had a different implementation registered by default inside MVC for rendering components statically.

I don't believe we need this any longer and it creates a hard to debug issue for our customers as it forces an order when customers want to provide a custom implementation (on something that we tell customers to customize).

I can't foresee any drawback on changing this to use TryAddScoped instead, so we should do so.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions