Skip to content
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

Serializing the Region type using System.Text.Json throws an exception. (OCC-302) #503

Closed
sarahelsaig opened this issue Oct 8, 2024 · 0 comments · Fixed by #504
Closed
Assignees
Labels
bug Something isn't working

Comments

@sarahelsaig
Copy link
Contributor

sarahelsaig commented Oct 8, 2024

Describe the bug

It throws a System.NotSupportedException with the following message:
Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with JsonConstructorAttribute is not supported. Type OrchardCore.Commerce.AddressDataType.Region.

To Reproduce

Easiest way to reproduce is:

using OrchardCore.Commerce.AddressDataType;
using System.Text.Json;

var json = JsonSerializer.Serialize(Regions.All);
var regions = JsonSerializer.Deserialize<IEnumerable<Region>>(json); // throws

Expected behavior

Should not throw.

Jira issue

@sarahelsaig sarahelsaig added the bug Something isn't working label Oct 8, 2024
@github-actions github-actions bot changed the title Serializing the Region type using System.Text.Json throws an exception. Serializing the Region type using System.Text.Json throws an exception. (OCC-302) Oct 8, 2024
@wAsnk wAsnk closed this as completed in #504 Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant