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

BreezeSharp SaveChanges MaxDepth exceeded #51

Closed
crane476 opened this issue Nov 19, 2021 · 7 comments
Closed

BreezeSharp SaveChanges MaxDepth exceeded #51

crane476 opened this issue Nov 19, 2021 · 7 comments

Comments

@crane476
Copy link

crane476 commented Nov 19, 2021

SaveChanges throws a JsonReaderException stating the reader's max depth of 64 has been exceeded when updating very large entities. I noticed the most recent update to Json.Net, version 13.0.1, sets the MaxDepth to 64 by default. If I revert to Json.Net version 12.0.3 no exception is thrown.

@steveschmitt
Copy link
Member

Thanks for finding this. Is the exception thrown on the client or server?

@crane476
Copy link
Author

Sorry for the late response, the exception was thrown on the client. I used fiddler to confirm that the server was returning the correct data.

@steveschmitt
Copy link
Member

Thanks for the clarification. It seems the easiest course would be to increase the MaxDepth in Json.Net, if that is possible.

@crane476
Copy link
Author

crane476 commented Nov 30, 2021

It is possible and I have a possible solution. EntityManager.SaveChanges() returns a SaveResult, which is the result of dataServiceAdapter.SaveChanges(entitiesToSave, saveOptions);. That function calls JNode.DeserializeFrom() a few times which is where I think this issue is occurring. JNode.DeserializeFrom() uses JsonTextReader, which has the MaxDepth property.

If you change var reader = new JsonTextReader(textReader); in Json.cs line 345 to var reader = new JsonTextReader(textReader) { MaxDepth = 128 }; then it should fix the issue.

I tried cloning the repo to test this myself, but I couldn't get it to compile on my machine.

@PusparagSubudhi
Copy link

Hi Was there any solution for this we are facing a similar issue where the ExecuteQuery is giving a maxdepth error. How to solve it?

@steveschmitt
Copy link
Member

I'll take a look soon, hopefully this weekend. How can I repro the problem?

@steveschmitt
Copy link
Member

I added the MaxDepth = 128 property; this should fix the issue.

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

No branches or pull requests

3 participants