Skip to content

Commit 2247d7f

Browse files
Copilotcaptainsafia
andcommitted
Fix JsonIgnore test case to prevent circular reference stack overflow
Co-authored-by: captainsafia <[email protected]>
1 parent 07e71a6 commit 2247d7f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.ComplexType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public class ComplexTypeWithJsonIgnore
4444
public string IgnoredProperty { get; set; } = null!;
4545
4646
[JsonIgnore]
47-
public CircularReferenceType CircularReference { get; set; } = new CircularReferenceType();
47+
public CircularReferenceType? CircularReference { get; set; }
4848
}
4949
5050
public class CircularReferenceType
5151
{
5252
[JsonIgnore]
53-
public ComplexTypeWithJsonIgnore Parent { get; set; } = new ComplexTypeWithJsonIgnore();
53+
public ComplexTypeWithJsonIgnore? Parent { get; set; }
5454
5555
public string Name { get; set; } = "test";
5656
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//HintName: ValidatableInfoResolver.g.cs
1+
//HintName: ValidatableInfoResolver.g.cs
22
#nullable enable annotations
33
//------------------------------------------------------------------------------
44
// <auto-generated>

0 commit comments

Comments
 (0)