Description
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to [email protected]. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
Using System.Text.Json to deserialize an object works on SSB and fails on CSB with identical JSON input data.
To Reproduce
Steps to reproduce the behavior:
- Using this version of ASP.NET Core 3.0.0
- Create a Blazor application using the server template
- Replace Index.razor with the attached file (within attached zip)
- Add the file Index.razor.cs (also in attached zip)
- Using NuGet, add Newtonsoft.Json to the project
- Run & observer proper deserialization by both Newsoft & System.Text.Json (As indicated by an OK status on the Index page)
- Now create a Blazor application using the WASM template with an Asp.NetCore host
- Add the same two files in the pages directory
- Edit the namespace in the .razor.cs to match your chosen name/directory
- Run the application
Failure #1: WASM: System.MissingMethodException: Default constructor not found for type Deserialize_CSB.Client.Pages.ServiceResult`1[[Deserialize_CSB.Client.Pages.Process_DD[], Deserialize-CSB.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
- Change the constructor for ServiceResult to public
- Rerun the application
Failure #2: WASM: System.Text.Json.JsonException: The JSON value could not be converted to Deserialize_CSB.Client.Pages.ServiceResult`1+eStatus[Deserialize_CSB.Client.Pages.Process_DD[]]. Path: $.pStatus | LineNumber: 0 | BytePositionInLine: 12.
Expected behavior
I expect CSB and SSB to both deserialize correctly.
Screenshots
n/a
Additional context
C:\Users\ms>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download