dotnet / dotnet/sdk

CA2000 does not report on JsonDocument instances returned from JsonDocument.Parse

Open
#50,311 3 comments 0 reactions 0 assignees View on GitHub
Area-Microsoft.CodeAnalysis.NetAnalyzers untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

[Re-created from the [original issue](https://github.com/dotnet/roslyn-analyzers/issues/6861) reported by @stephentoub in the old repo]

JsonDocument is disposable, but CA2000 is not reported for `JsonDocument.Parse` calls like this:

JsonElement json = JsonDocument.Parse(...).RootElement;

CA2000 should warn that the JsonDocument instance returned from Parse needs to be disposed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.