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

The reader's MaxDepth of 64 has been exceeded #284

Open
scottstauffer-fc opened this issue May 17, 2023 · 3 comments
Open

The reader's MaxDepth of 64 has been exceeded #284

scottstauffer-fc opened this issue May 17, 2023 · 3 comments

Comments

@scottstauffer-fc
Copy link

We ran pbitools.exe extract Dashbord XXXX.pbix and we get this error message.

If I take the line 1 and replace the period, I have 62 rows... hmm... each one creates a depth in the indentation?
Can we change the MaxDepth to 128? or 1024 or 8192?

:)

An unhandled exception occurred.

Newtonsoft.Json.JsonReaderException: The reader's MaxDepth of 64 has been exceeded. Path 'bookmarks[18].explorationState.sections.ReportSection227598f4bf4b2761c77a.visualContainers.97e8dfb9dfbc662ad879.filters.byName.Filterf29b284743a718774aa2.filter.Where[0].Condition.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.And.Left.Not.Expression.Comparison.Left.Column.Expression', line 1, position 1283486.

   at Newtonsoft.Json.JsonReader.Push(JsonContainerType value)

   at Newtonsoft.Json.JsonTextReader.ParseValue()

   at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)

   at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)

   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)

   at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader, JsonLoadSettings settings)

   at Newtonsoft.Json.Linq.JToken.Parse(String json, JsonLoadSettings settings)

   at PbiTools.Utils.JsonExtensions.ExtractToken[T](JObject parent, String property, IProjectFolder folder)

   at PbiTools.Serialization.ReportSerializer.Serialize(JObject content)

   at PbiTools.Model.PbixModel.ToFolder(String path, PbixProjectSettings settings)

   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Nullable1 pid, Nullable1 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization, Boolean watch)

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at PowerArgs.ArgAction.Invoke()

   at PbiTools.Program.Main(String[] args)

@scottstauffer-fc
Copy link
Author

Ah, it is configurable!
I'll have to beg and plead for someone to make this change to issue a pull request.

Maximum depth

The latest version of Newtonsoft.Json has a maximum depth limit of 64 by default. System.Text.Json also has a default limit of 64, and it's configurable by setting JsonSerializerOptions.MaxDepth.

If you're using System.Text.Json indirectly by using ASP.NET Core, the default maximum depth limit is 32. The default value is the same as for model binding and is set in the JsonOptions class.

Source - Microsoft Learn - .NET JSON Serialization

@scottstauffer-fc
Copy link
Author

Source - MaxDepth setting - Json.NET Documentation - newtonsoft.com

MaxDepth setting

This sample uses the MaxDepth setting to constrain JSON to a maximum depth when deserializing.

Sample:

image

@scottstauffer-fc
Copy link
Author

I think I found out where the change is needed - I just need to see what I can do make this happen!

image

scottstauffer-fc added a commit to scottstauffer-fc/pbi-tools that referenced this issue May 17, 2023
Added row to indicate new, non default, MaxDepth,
Re pbi-tools#284
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

1 participant