Skip to content

'GetAuthenticationStateAsync was called before SetAuthenticationState.' #17442

Closed
@Grauenwolf

Description

@Grauenwolf

Describe the bug

GetAuthenticationStateAsync throws an InvalidOperationException with the message:

'GetAuthenticationStateAsync was called before SetAuthenticationState.'

I do not know if this is an actual bug or just a lack of documentation on its correct use.

ref: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.server.serverauthenticationstateprovider?view=aspnetcore-3.0

To Reproduce

Inject a ServerAuthenticationStateProvider into a page. Then call 'GetAuthenticationStateAsync in any of its async-events.

Further technical details

<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />

Metadata

Metadata

Labels

✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Components

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions