Just installed Core 3 preview 7 and created a test Blazor app using the default templates. When targeting the client at ".NET Standard 2.0" the application runs and works as expected. When targeting ".NET Standard 2.1" the app compiles and launches but after loading the framework libraries (mono and webassembly) the exception below is thrown and the app stops. I'm using
VS 2019 Preveiw 16.3.0 and launching under IISExpress. To repro just create a Blazor hosted app and change the "Client" app to target ".NET Standard 2.1".
blazor.webassembly.js:1 WASM: System.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 WASM: at System.Text.Json.JsonSerializer.WriteCoreString (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x1c52b28 + 0x00044> in :0
blazor.webassembly.js:1 WASM: at System.Text.Json.JsonSerializer.ToStringInternal (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x1c527b8 + 0x0000c> in :0
blazor.webassembly.js:1 WASM: at System.Text.Json.JsonSerializer.Serialize[TValue] (TValue value, System.Text.Json.JsonSerializerOptions options) <0x1c526f8 + 0x0000c> in :0
blazor.webassembly.js:1 WASM: at Microsoft.JSInterop.JSInProcessRuntimeBase.Invoke[TValue] (System.String identifier, System.Object[] args) <0x1c22778 + 0x00014> in <0451d7e25d89403c929d2b8ba87c7234>:0
blazor.webassembly.js:1 WASM: at Microsoft.AspNetCore.Blazor.Rendering.WebAssemblyRenderer.AddComponentAsync (System.Type componentType, System.String domElementSelector) <0x1bdcda8 + 0x00066> in <0538dd4072404eb2a3f2b5d81b656f78>:0
blazor.webassembly.js:1 WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyBlazorApplicationBuilder.CreateRendererAsync () <0x1bbb890 + 0x000b2> in <0538dd4072404eb2a3f2b5d81b656f78>:0
blazor.webassembly.js:1 WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyHost.StartAsyncAwaited () <0x1ba1b78 + 0x001f8> in <0538dd4072404eb2a3f2b5d81b656f78>:0
blazor.webassembly.js:1 WASM: --- End of inner exception stack trace ---
blazor.webassembly.js:1 WASM: ---> (Inner Exception #0) System.TypeLoadException: VTable setup of type System.Text.Json.Utf8JsonWriter failed
blazor.webassembly.js:1 WASM: at System.Text.Json.JsonSerializer.WriteCoreString (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x1c52b28 + 0x00044> in :0
blazor.webassembly.js:1 WASM: at System.Text.Json.JsonSerializer.ToStringInternal (System.Object value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x1c527b8 + 0x0000c> in :0
blazor.webassembly.js:1 WASM: at System.Text.Json.JsonSerializer.Serialize[TValue] (TValue value, System.Text.Json.JsonSerializerOptions options) <0x1c526f8 + 0x0000c> in :0
blazor.webassembly.js:1 WASM: at Microsoft.JSInterop.JSInProcessRuntimeBase.Invoke[TValue] (System.String identifier, System.Object[] args) <0x1c22778 + 0x00014> in <0451d7e25d89403c929d2b8ba87c7234>:0
blazor.webassembly.js:1 WASM: at Microsoft.AspNetCore.Blazor.Rendering.WebAssemblyRenderer.AddComponentAsync (System.Type componentType, System.String domElementSelector) <0x1bdcda8 + 0x00066> in <0538dd4072404eb2a3f2b5d81b656f78>:0
blazor.webassembly.js:1 WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyBlazorApplicationBuilder.CreateRendererAsync () <0x1bbb890 + 0x000b2> in <0538dd4072404eb2a3f2b5d81b656f78>:0
blazor.webassembly.js:1 WASM: at Microsoft.AspNetCore.Blazor.Hosting.WebAssemblyHost.StartAsyncAwaited () <0x1ba1b78 + 0x001f8> in <0538dd4072404eb2a3f2b5d81b656f78>:0 <---
blazor.webassembly.js:1
@pranavkm @danroth27 should this go to blazor? Looks like it's having trouble with Utf8JsonWriter. It's a sealed type that implements 2 interfaces: IDisposable and IAsyncDisposable. I'm guessing its having trouble with IAsyncDisposable. The NETStandard implementation of System.Text.Json depends on the out-of-band definition of IAsyncDisposable, which will require the facade that forwards this to netstandard.dll. Blazor should be able to see these.
Chatted with @danroth27 and he mentioned that this could be due to mono lagging in netstandard2.1 support. I can imagine that if they were missing a typeforward in netstandard.dll for IAsyncDisposable this could happen.
Duplicate of https://github.com/aspnet/AspNetCore/issues/12568. Moving to that repo since I believe this to be a blazor (or mono) issue.