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.
Use
TryAddScopedhere instead ofAddScopedaspnetcore/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
TryAddScopedinstead, so we should do so.