Our usage of JsonDocument does not utilize the using statement. According to Docs, the JsonDocument class implements IDisposable which: "utilizes resources from pooled memory to minimize the impact of the garbage collector (GC) in high-usage scenarios. Failure to properly dispose this object will result in the memory not being returned to the pool, which will increase GC impact across various parts of the framework."
For example, usage in SqlQueryEngine, return JsonDocument however, when properly adding using, this will dispose the object upon method conclusion, resulting in object disposed exceptions/errors. I have taken a first attempt at partially remediating the issue in my PrimaryKeyValidation PR here in RestController.cs: https://github.com/Azure/hawaii-gql/pull/113/files#diff-d55d0bae88d3e597b835bf59413be4c3c30ca79572e14e3b0bb915c942c1716d
Our usage of
JsonDocumentdoes not utilize theusingstatement. According to Docs, theJsonDocumentclass implementsIDisposablewhich: "utilizes resources from pooled memory to minimize the impact of the garbage collector (GC) in high-usage scenarios. Failure to properly dispose this object will result in the memory not being returned to the pool, which will increase GC impact across various parts of the framework."For example, usage in SqlQueryEngine, return
JsonDocumenthowever, when properly addingusing, this will dispose the object upon method conclusion, resulting in object disposed exceptions/errors. I have taken a first attempt at partially remediating the issue in my PrimaryKeyValidation PR here inRestController.cs: https://github.com/Azure/hawaii-gql/pull/113/files#diff-d55d0bae88d3e597b835bf59413be4c3c30ca79572e14e3b0bb915c942c1716d