Remove default JSON size limitation #520
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Change allows JavaScriptSerializer to deserialize the largest possible JSON file. Otherwise large log files from chatty PowerShell scripts will exceed the default limit of 4MB and throw an exception.
No such limitation exists on async_status.py, so this brings the PowerShell script better in line with that
ISSUE TYPE
COMPONENT NAME
async_status.ps1
ADDITIONAL INFORMATION
If an async tasks output exceeds 4MB (The default size limit for System.Web.Script.Serialization.JavaScriptSerializer), the deserialization will fail, throwing an exception and failing the async task.
The limit is arbitrary, and is implemented by a simple integer value that the file length is compared against. There is no practical upper limit, except for system resources.
Microsoft documentation: https://learn.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer.maxjsonlength?
Microsoft source code: https://referencesource.microsoft.com/#system.web.extensions/Script/Serialization/JavaScriptSerializer.cs
I can see no reason to maintain a hard limitation. The python equivalent of this module (async_status.py) uses Python's json library, which has no built-in hard limitation.