Skip to content

Commit 90c105e

Browse files
committed
Run dotnet format to clean up whitespace
1 parent 5bbbec2 commit 90c105e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.NetCore.Analyzers/Runtime/PreferJsonElementParse.Fixer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
7979
// Create the replacement: JsonElement.Parse(...)
8080
// We need to use the same arguments that were passed to JsonDocument.Parse
8181
var arguments = invocation.Arguments.Select(arg => arg.Syntax).ToArray();
82-
82+
8383
SyntaxNode memberAccess = generator.MemberAccessExpression(
8484
generator.TypeExpressionForStaticMemberAccess(jsonElementType),
8585
"Parse");
86-
86+
8787
SyntaxNode replacement = generator.InvocationExpression(memberAccess, arguments);
8888

8989
// Replace the entire property reference (JsonDocument.Parse(...).RootElement) with JsonElement.Parse(...)

src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.NetCore.Analyzers/Runtime/PreferJsonElementParse.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public override void Initialize(AnalysisContext context)
125125
// Now we have the pattern: JsonDocument.Parse(...).RootElement
126126
// Check if the JsonDocument is disposed. We'll look for patterns where it's immediately
127127
// accessed and not stored, which is the primary concern.
128-
128+
129129
// If the parent operation is an assignment to a variable of type JsonElement,
130130
// and the JsonDocument is never stored, this is the problematic pattern.
131131
if (IsImmediateUseWithoutDisposal(propertyReference))
@@ -147,13 +147,13 @@ private static bool IsImmediateUseWithoutDisposal(IPropertyReferenceOperation pr
147147

148148
// If we walk up the tree and never find the JsonDocument being stored in a variable
149149
// or being used in a using statement, then it's not being disposed properly.
150-
150+
151151
// For simplicity, we'll flag any case where:
152152
// 1. The property reference is the direct result of JsonDocument.Parse()
153153
// 2. The result is not part of a using declaration/statement
154-
154+
155155
IOperation? current = propertyReference.Parent;
156-
156+
157157
// Walk up to find if this is within a using statement/declaration
158158
while (current != null)
159159
{
@@ -162,14 +162,14 @@ private static bool IsImmediateUseWithoutDisposal(IPropertyReferenceOperation pr
162162
// It's within a using statement, so it's being disposed
163163
return false;
164164
}
165-
165+
166166
// Check for using declaration
167167
if (current is IUsingDeclarationOperation)
168168
{
169169
// It's a using declaration, so it's being disposed
170170
return false;
171171
}
172-
172+
173173
current = current.Parent;
174174
}
175175

0 commit comments

Comments
 (0)