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

Test JSON serialization of EF object graphs #20827

Merged
merged 1 commit into from
May 31, 2020

Conversation

ajcvickers
Copy link
Member

@ajcvickers ajcvickers commented May 3, 2020

Fixes #20548

Added tests that serialize graphs with both the BCL Json support and Newtonsoft.Json.

Findings:

  • BCL Json
    • Preserving references working fine; needed to increase max-depth for heavily nested graph, but exception message was clear
    • Lack of an Ignore option may be missed because output is harder to understand when it contains many internal references. Will follow up on this.
  • Newtonsoft.JSON
    • Found it easy to get out-of-memory errors even when ignoring cycles
    • Got stack overflow errors when attempting to serialize cycles instead of ignoring them
    • I'm probably not configuring things correctly here, but this isn't high priority
  • Net Topology Suite types are not JSON-serialization-friendly; will follow up on this

@ajcvickers ajcvickers requested a review from dougbu as a code owner May 3, 2020 22:05
@ajcvickers ajcvickers requested a review from a team May 3, 2020 22:05
@ajcvickers
Copy link
Member Author

/cc @jeffhandley @jozkee

@ajcvickers ajcvickers force-pushed the SerializeAllTheThings0428 branch 2 times, most recently from 2a989e4 to 01f2dc2 Compare May 6, 2020 21:51
@ajcvickers ajcvickers force-pushed the SerializeAllTheThings0428 branch 3 times, most recently from b6e8f22 to 0ec1f59 Compare May 23, 2020 21:43
@ajcvickers
Copy link
Member Author

@dotnet/efcore Can I get a review of this now. (I ended up having to remove one of the tests because the Mac C.I. agents continually ran out of memory trying to serialize the graph.)

Fixes #20548

Added tests that serialize graphs with both the BCL Json support and Newtonsoft.Json.

Findings:
*  BCL Json
  * Preserving references working fine; needed to increase max-depth for heavily nested graph, but exception message was clear
  * Lack of an Ignore option may be missed because output is harder to understand when it contains many internal references. Will follow up on this.
* Newtonsoft.JSON
  * Found it easy to get out-of-memory errors even when ignoring cycles
  * Got stack overflow errors when attempting to serialize cycles instead of ignoring them
  * I'm probably not configuring things correctly here, but this isn't high priority
* Net Topology Suite types are not JSON-serialization-friendly; will follow up on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add EF tests that serialize JSON
3 participants