Blazor Server-side: New Template for preview 4 first load server exception
See original GitHub issueNewly created Blazor server side throws a server exception on first page load.
Just created a new Blazor server-side project from the templates. On first run it throws an exception when it attempts to connect to SignalR making the page non interactive since it only shows the prerendered content.
The exception is due to a Type mismatch for System.Text.Json.Utf8JsonWriter
which is shown on the network tab for the browser.
To Reproduce
Steps to reproduce the behavior:
- Using this version of ASP.NET Core ‘3.0.0-preview5-27618-16’
- Using Visual Studio 2019 16.1 preview
- Create a new Blazor Server-side (Still named Razor Components) template
- Run the created template via F5
Expected behavior
Page will become interactive after prerendering and no 500 internal server errors
on browser network tab.
Additional context
Here’s the stack trace given on the network tab.
System.TypeLoadException: Could not load type 'System.Text.Json.Utf8JsonWriter' from assembly 'Microsoft.AspNetCore.Http.Connections.Common, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' due to value type mismatch.
at Microsoft.AspNetCore.Http.Connections.NegotiateProtocol.WriteResponse(NegotiationResponse response, IBufferWriter`1 output)
at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher.WriteNegotiatePayload(IBufferWriter`1 writer, String connectionId, HttpContext context, HttpConnectionDispatcherOptions options)
at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher.ProcessNegotiate(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher.ExecuteNegotiateAsync(HttpContext context, HttpConnectionDispatcherOptions options)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
HEADERS
=======
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: close
Content-Length: 0
Content-Type: text/plain;charset=UTF-8
Host: localhost:44398
Pragma: no-cache
Referer: https://localhost:44398/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36
origin: https://localhost:44398
x-requested-with: XMLHttpRequest
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Blazor Server-side: New Template for preview 4 first load ...
Newly created Blazor server side throws a server exception on first page load. Just created a new Blazor server-side project from the templates....
Read more >Blazor Server .NET 8 Preview 6 Default Template Error on ...
I create a new Blazor Server project and when I start it from cmd with dotnet watch it works great. But when I...
Read more >ASP.NET Core updates in .NET 8 Preview 4
NET 8 Preview 4 is now available and includes many great new ... Here's what a simple server-side rendered form in Blazor looks...
Read more >.NET 8 Preview 5 Combines Blazor Changes in Project ...
The new project template includes the plumbing you need to enable server-side, and streaming, rendering for your Blazor app. A quick recap:.
Read more >Enabling prerendering for Blazor WebAssembly apps
In this post I describe how to host a Blazor WebAssembly app in an ASP.NET Core app and how to enable WebAssembly prerendering....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
3.0.100-preview5-011498
didn’t have the fix, but the next one did. So3.0.100-preview5-011504
works.The new build works now