Skip to content

.NET5 RC1: WebAssemblyPrerendered with authentication enabled #26270

@ChristianWeyer

Description

@ChristianWeyer

Trying to activate WASM pre-rendering gets a lot more involved and complicated when you are beyond a Hello World app. E.g. if you have authentication in your Blazor WASM client and want to do pre-rendering, you get this exception:

InvalidOperationException: Cannot provide a value for property 'AuthenticationStateProvider' on type 'Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState'. There is no registered service of type 'Microsoft.AspNetCore.Components.Authorization.AuthenticationStateProvider'.
Microsoft.AspNetCore.Components.ComponentFactory+<>c__DisplayClass6_0.<CreateInitializer>g__Initialize|2(IServiceProvider serviceProvider, IComponent component)

Is there a best practice here to solve this?

.cc @guardrex

.NET 5 SDK: 5.0.100-rc.1.20452.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: DuplicateResolved as a duplicate of another issueStatus: Resolvedaffected-fewThis issue impacts only small number of customersarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyfeature-blazor-wasm-authseverity-majorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions