question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor Server-side: New Template for preview 4 first load server exception

See original GitHub issue

Newly 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:

  1. Using this version of ASP.NET Core ‘3.0.0-preview5-27618-16’
  2. Using Visual Studio 2019 16.1 preview
  3. Create a new Blazor Server-side (Still named Razor Components) template
  4. 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:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
BrennanConroycommented, Apr 20, 2019

3.0.100-preview5-011498 didn’t have the fix, but the next one did. So 3.0.100-preview5-011504 works.

1reaction
davidfowlcommented, Apr 20, 2019

The new build works now

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found