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.
Steps to reproduce the behavior:
Page will become interactive after prerendering and no 500 internal server errors on browser network tab.
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
You're using the latest dev bits which has a known breaking change in Json. AspNetCore reacted to the breaking changes this morning so a newer SDK should work soon. There might not be one yet, but hopefully there will be a new SDK with the fixes shortly.
Using this version of ASP.NET Core '3.0.0-preview5-27618-16'
The bug title says preview4, did you mean preview5? As Brennan said there's a known issue right now with the latest bits.
@davidfowl Ah my bad a typo on the title kinda of mixed up the preview 4 annoucement of Blazor with the latest Core SDK version.
Will be waiting for a new build until then, or is the new preview bits right now (3.0.100-preview5-011498) fixed the issue?
The new build works now
3.0.100-preview5-011498 didn't have the fix, but the next one did. So 3.0.100-preview5-011504 works.
@BrennanConroy @davidfowl thanks for the heads up. Just confirmed it works now on the latest builds.
I have the same issue in 3.0.0-preview8.19405.7
After I switched Blazor app to netstandard2.1
WASM: 锘縎ystem.AggregateException: One or more errors occurred. (VTable setup of type System.Text.Json.Utf8JsonWriter failed) ---> System.TypeLoadException: VTable setup of type System.Text.Json.Utf8JsonWriter failed
blazor.webassembly.js (1,34758)
WASM: at System.Text.Json.JsonSerializer.WriteCoreString (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x253ef10 + 0x00040> in <81a388037f1e4d689d9e115f9e29289e>:0
blazor.webassembly.js (1,34758)
WASM: at System.Text.Json.JsonSerializer.ToStringInternal (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x253eb28 + 0x0000c> in <81a388037f1e4d689d9e115f9e29289e>:0
blazor.webassembly.js (1,34758)
WASM: at System.Text.Json.JsonSerializer.Serialize[TValue] (TValue value, System.Text.Json.JsonSerializerOptions options) <0x253ea68 + 0x0000c> in <81a388037f1e4d689d9e115f9e29289e>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.JSInterop.JSInProcessRuntimeBase.Invoke[TValue] (System.String identifier, System.Object[] args) <0x2528048 + 0x00014> in <30781c3ac5104a4783ec7e7411267cbe>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.AspNetCore.Blazor.Rendering.WebAssemblyRenderer.AddComponentAsync (System.Type componentType, System.String domElementSelector) <0x24d92b8 + 0x00066> in <1dd705d10aa5496ca9eea490dc558f6c>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyBlazorApplicationBuilder.CreateRendererAsync () <0x248d3c8 + 0x000dc> in <1dd705d10aa5496ca9eea490dc558f6c>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyHost.StartAsyncAwaited () <0x247ae40 + 0x001f4> in <1dd705d10aa5496ca9eea490dc558f6c>:0
blazor.webassembly.js (1,34758)
WASM: --- End of inner exception stack trace ---
blazor.webassembly.js (1,34758)
WASM: ---> (Inner Exception #0) System.TypeLoadException: VTable setup of type System.Text.Json.Utf8JsonWriter failed
blazor.webassembly.js (1,34758)
WASM: at System.Text.Json.JsonSerializer.WriteCoreString (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x253ef10 + 0x00040> in <81a388037f1e4d689d9e115f9e29289e>:0
blazor.webassembly.js (1,34758)
WASM: at System.Text.Json.JsonSerializer.ToStringInternal (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x253eb28 + 0x0000c> in <81a388037f1e4d689d9e115f9e29289e>:0
blazor.webassembly.js (1,34758)
WASM: at System.Text.Json.JsonSerializer.Serialize[TValue] (TValue value, System.Text.Json.JsonSerializerOptions options) <0x253ea68 + 0x0000c> in <81a388037f1e4d689d9e115f9e29289e>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.JSInterop.JSInProcessRuntimeBase.Invoke[TValue] (System.String identifier, System.Object[] args) <0x2528048 + 0x00014> in <30781c3ac5104a4783ec7e7411267cbe>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.AspNetCore.Blazor.Rendering.WebAssemblyRenderer.AddComponentAsync (System.Type componentType, System.String domElementSelector) <0x24d92b8 + 0x00066> in <1dd705d10aa5496ca9eea490dc558f6c>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyBlazorApplicationBuilder.CreateRendererAsync () <0x248d3c8 + 0x000dc> in <1dd705d10aa5496ca9eea490dc558f6c>:0
blazor.webassembly.js (1,34758)
WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyHost.StartAsyncAwaited () <0x247ae40 + 0x001f4> in <1dd705d10aa5496ca9eea490dc558f6c>:0 <---
blazor.webassembly.js (1,34758)
WASM:
blazor.webassembly.js (1,34758)