Consider registering the authentication state provider conditionally #41235
Labels
area-blazor
Includes: Blazor, Razor Components
feature-blazor-server
feature-blazor-server-auth
good first issue
Good for newcomers.
help wanted
Up for grabs. We would accept a PR to help resolve this issue
Milestone
Use
TryAddScoped
here instead ofAddScoped
aspnetcore/src/Components/Server/src/DependencyInjection/ComponentServiceCollectionExtensions.cs
Line 82 in 02e7e14
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.The text was updated successfully, but these errors were encountered: