-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Jsoncode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixerhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
#108930 represents an approved API for .NET 10 that adds JsonElement.Parse methods. Before its existence, developers would write things like:
JsonElement element = JsonDocument.Parse("json").RootElement;which ends up renting an array from the ArrayPool with the JsonDocument but then never returning it because the JsonDocument isn't disposed.
We should add an analyzer/fixer that flags common patterns folks have used for getting a JsonElement, as called out in #108930, and recommend switching to use the new JsonElement.Parse methods.
eiriktsarpalis, colejohnson66, gregsdennis, ArminShoeibi, PaulusParssinen and 3 more
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Jsoncode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixerhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged