-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
I updated my machine with .Net (6.0.100-rc.2.21505.57). While testing various parts of my Blazor WebAssembly App, I started getting a System.NotSupportedException from a WebAPI call. An exception was being thrown trying to JsonSerialize a class with a double[,] property that had the [JsonIgnore] attribute.
Reproduction Steps
Here is a minimal API version of an app that exhibits the issue:
using System.Text.Json;
using System.Text.Json.Serialization;
Sample items = new();
Console.WriteLine($"Serialized = : {JsonSerializer.Serialize(items)}");
public class Sample
{
[JsonIgnore]
public double[,] Data { get; set; }
}
Expected behavior
The expectation is that the JsonSerializer would check for a JsonIgnore attribute before performing any other property validation checks.
Actual behavior
The JsonSerializer does not check for a JsonIgnore attribute before determining if the data type is supported.
Regression?
I don't recall which version of .Net6 I had been testing before I updated, but it was more than likely the public version prior to 6.0.100-rc.2.21505.57.
Known Workarounds
The workaround I used, was to drop back to the early days of Getter and Setter methods instead of using a property.
Configuration
.Net
Blazor WebAssembly Application using .Net 6.0.100-rc.2.21505.57
OS Version
Windows 10 Pro x64, Version 21H1, OS build 19043.1237 with Windows Feature Experience Pack 120.2212.3530.
Browser
Microsoft Edge
Version 95.0.1020.40 (Official build) (64-bit)
Editor
Microsoft Visual Studio Community 2022 Preview (64-bit)
Version 17.0.0 Preview 7.0
Other information
No response