-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonSerializer constructor binding should support differences between property and parameter so long the property is assignable to the parameter #53303
Comments
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsI have the following class: public sealed class CrawledAreaOwnerEntry
{
public CrawledAreaOwnerEntry(string area, string lead, IEnumerable<string> owners)
{
Area = area;
Lead = lead;
Owners = owners.ToArray();
}
public string Area { get; }
public string Lead { get; }
public IReadOnlyList<string> Owners { get; }
} When deserializing it, I get the following exception:
It seems the serializer requires the types of the properties to be identical to the parameter. That feels overly restrictive to me; it seems we should only require that the property type is assignable to the parameter type.
|
Perhaps this is the same issue as #44428? |
I have the following class:
When deserializing it, I get the following exception:
It seems the serializer requires the types of the properties to be identical to the parameter. That feels overly restrictive to me; it seems we should only require that the property type is assignable to the parameter type.
The text was updated successfully, but these errors were encountered: