How to fix "GetAuthenticationStateAsync was called before SetAuthenticationState" in Blazor MAUI project ?
I already have a Blazor Server application with authentication type "individual accounts". Everything is working.
Now i want to try out MAUI, so i created a razor class library in the solution and moved all logic from BlazorServer to the Razor Class Library project.
Fixed HTML styling and so on so the application runs as before. Everything works good including authentication.
Now, i added MAUI Blazor project to the solution, run the MAUI application and it run as expected.
Now, I referenced the Razor Class Library Project. Tried displaying the UI from RazorClassLibrary by running the RazorClassLibrary.App from MauiBlazor's Main.razor.
Now getting the error:
GetAuthenticationStateAsync was called before SetAuthenticationState.
at Microsoft.AspNetCore.Components.Server.ServerAuthenticationStateProvider.GetAuthenticationStateAsync()
at Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState.OnInitialized()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
How can i fix this ?