System.Text.Json incorrectly requires construct parameter types to match immutable property types. #47422
Labels
area-System.Text.Json
enhancement
Product code improvement that does NOT require public API changes/additions
Milestone
Description
System.Text.Json deserialization requires that a property type match the constructor type for immutable properties even though the constructor can convert the type.
This is a simple example of a class that will convert an incoming IEnumerable to a ReadOnlyObservableCollection for XAML binding.
When desrializing from JSON, this fails.
Changing the property to be IEnumerable allows the deserialization to succeed, but that means I would need to add “another” property to this class for XAML binding to work. (Which is what this class is used for). The below just doesn’t seem right and was not something I had to do when using NewtonSoft
The text was updated successfully, but these errors were encountered: