You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created solution using template "Blazor Web App" in .NET8, webassembly as interactive render mode and per page/component interactivity location. My index page looks like this:
In both client and server apps, I have added line to programs.cs: builder.Services.AddCascadingAuthenticationState();
When I run the app I immediately get error page with exception
InvalidOperationException: JavaScript interop calls cannot be issued during server-side static rendering, because the page has not yet loaded in the browser. Statically-rendered components must wrap any JavaScript interop calls in conditional logic to ensure those interop calls are not attempted during static rendering.
Microsoft.AspNetCore.Components.Endpoints.UnsupportedJavaScriptRuntime.Microsoft.JSInterop.IJSRuntime.InvokeAsync(string identifier, object[] args)
Stacktrace points to Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync()
Any ideas what have I done wrong?
PS. After looking into network tab I have noticed that webassembly dlls are never fetched, why?
After adding @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" to Routes component I get different error:
blazor.web.js:1 Error: One or more errors occurred. (Root component type 'OakLab.Server.Components.Routes' could not be found in the assembly 'OakLab.Server'.)
at Jn (marshal-to-js.ts:349:18)
at Ul (marshal-to-js.ts:306:28)
at 00b1ee2e:0x1facb
at 00b1ee2e:0x1bf8c
at 00b1ee2e:0xf173
at 00b1ee2e:0x1e7e5
at 00b1ee2e:0x1efdb
at 00b1ee2e:0xcfed
at 00b1ee2e:0x44108
at e.<computed> (cwraps.ts:338:24)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have created solution using template "Blazor Web App" in .NET8, webassembly as interactive render mode and per page/component interactivity location. My index page looks like this:
my App.razor is:
my Routes:
and my Layout is empty (just @Body).
In both client and server apps, I have added line to programs.cs:
builder.Services.AddCascadingAuthenticationState();
When I run the app I immediately get error page with exception
Stacktrace points to
Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync()
Any ideas what have I done wrong?
PS. After looking into network tab I have noticed that webassembly dlls are never fetched, why?
After adding
@rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"
to Routes component I get different error:Beta Was this translation helpful? Give feedback.
All reactions