Skip to content

Commit 3648d83

Browse files
Add ReferenceHandler to JsonSourceGenerationOptions (#109174)
* add reference handler prop * add tests * remove bom * refactor out ReferenceHandlingStrategy * Fix emit of enum and add tests
1 parent 6ed953a commit 3648d83

26 files changed

+184
-36
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace System.Text.Json.Serialization
5+
{
6+
/// <summary>
7+
/// The <see cref="ReferenceHandler"/> to be used at run time.
8+
/// </summary>
9+
public enum JsonKnownReferenceHandler
10+
{
11+
/// <summary>
12+
/// Specifies that circular references should throw exceptions.
13+
/// </summary>
14+
Unspecified = 0,
15+
16+
/// <summary>
17+
/// Specifies that the built-in <see cref="ReferenceHandler.Preserve"/> be used to handle references.
18+
/// </summary>
19+
Preserve = 1,
20+
21+
/// <summary>
22+
/// Specifies that the built-in <see cref="ReferenceHandler.IgnoreCycles"/> be used to ignore cyclic references.
23+
/// </summary>
24+
IgnoreCycles = 2,
25+
}
26+
}

src/libraries/System.Text.Json/Common/JsonSourceGenerationOptionsAttribute.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public JsonSourceGenerationOptionsAttribute(JsonSerializerDefaults defaults)
115115
/// </summary>
116116
public JsonCommentHandling ReadCommentHandling { get; set; }
117117

118+
/// <summary>
119+
/// Specifies the default value of <see cref="JsonSerializerOptions.ReferenceHandler"/> when set.
120+
/// </summary>
121+
public JsonKnownReferenceHandler ReferenceHandler { get; set; }
122+
118123
/// <summary>
119124
/// Specifies the default value of <see cref="JsonSerializerOptions.RespectNullableAnnotations"/> when set.
120125
/// </summary>

src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ private sealed partial class Emitter
3737
private const string OptionsLocalVariableName = "options";
3838
private const string ValueVarName = "value";
3939
private const string WriterVarName = "writer";
40+
private const string PreserveReferenceHandlerPropertyName = "Preserve";
41+
private const string IgnoreCyclesReferenceHandlerPropertyName = "IgnoreCycles";
4042

4143
private static readonly AssemblyName s_assemblyName = typeof(Emitter).Assembly.GetName();
4244

@@ -70,6 +72,7 @@ private sealed partial class Emitter
7072
private const string JsonPropertyInfoValuesTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues";
7173
private const string JsonTypeInfoTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonTypeInfo";
7274
private const string JsonTypeInfoResolverTypeRef = "global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver";
75+
private const string ReferenceHandlerTypeRef = "global::System.Text.Json.Serialization.ReferenceHandler";
7376
private const string EmptyTypeArray = "global::System.Array.Empty<global::System.Type>()";
7477

7578
/// <summary>
@@ -1246,6 +1249,9 @@ private static void GetLogicForDefaultSerializerOptionsInit(SourceGenerationOpti
12461249
if (optionsSpec.ReadCommentHandling is JsonCommentHandling readCommentHandling)
12471250
writer.WriteLine($"ReadCommentHandling = {FormatCommentHandling(readCommentHandling)},");
12481251

1252+
if (optionsSpec.ReferenceHandler is JsonKnownReferenceHandler referenceHandler)
1253+
writer.WriteLine($"ReferenceHandler = {FormatReferenceHandler(referenceHandler)},");
1254+
12491255
if (optionsSpec.UnknownTypeHandling is JsonUnknownTypeHandling unknownTypeHandling)
12501256
writer.WriteLine($"UnknownTypeHandling = {FormatUnknownTypeHandling(unknownTypeHandling)},");
12511257

@@ -1280,6 +1286,20 @@ static string FormatNamingPolicy(JsonKnownNamingPolicy knownNamingPolicy)
12801286
? $"{JsonNamingPolicyTypeRef}.{policyName}"
12811287
: "null";
12821288
}
1289+
1290+
static string FormatReferenceHandler(JsonKnownReferenceHandler referenceHandler)
1291+
{
1292+
string? referenceHandlerName = referenceHandler switch
1293+
{
1294+
JsonKnownReferenceHandler.Preserve => PreserveReferenceHandlerPropertyName,
1295+
JsonKnownReferenceHandler.IgnoreCycles => IgnoreCyclesReferenceHandlerPropertyName,
1296+
_ => null,
1297+
};
1298+
1299+
return referenceHandlerName != null
1300+
? $"{ReferenceHandlerTypeRef}.{referenceHandlerName}"
1301+
: "null";
1302+
}
12831303
}
12841304

12851305
private static void GenerateConverterHelpers(SourceWriter writer, bool emitGetConverterForNullablePropertyMethod)

src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ private SourceGenerationOptionsSpec ParseJsonSourceGenerationOptionsAttribute(IN
280280
bool? propertyNameCaseInsensitive = null;
281281
JsonKnownNamingPolicy? propertyNamingPolicy = null;
282282
JsonCommentHandling? readCommentHandling = null;
283+
JsonKnownReferenceHandler? referenceHandler = null;
283284
JsonUnknownTypeHandling? unknownTypeHandling = null;
284285
JsonUnmappedMemberHandling? unmappedMemberHandling = null;
285286
bool? useStringEnumConverter = null;
@@ -379,6 +380,10 @@ private SourceGenerationOptionsSpec ParseJsonSourceGenerationOptionsAttribute(IN
379380
readCommentHandling = (JsonCommentHandling)namedArg.Value.Value!;
380381
break;
381382

383+
case nameof(JsonSourceGenerationOptionsAttribute.ReferenceHandler):
384+
referenceHandler = (JsonKnownReferenceHandler)namedArg.Value.Value!;
385+
break;
386+
382387
case nameof(JsonSourceGenerationOptionsAttribute.UnknownTypeHandling):
383388
unknownTypeHandling = (JsonUnknownTypeHandling)namedArg.Value.Value!;
384389
break;
@@ -434,6 +439,7 @@ private SourceGenerationOptionsSpec ParseJsonSourceGenerationOptionsAttribute(IN
434439
PropertyNameCaseInsensitive = propertyNameCaseInsensitive,
435440
PropertyNamingPolicy = propertyNamingPolicy,
436441
ReadCommentHandling = readCommentHandling,
442+
ReferenceHandler = referenceHandler,
437443
UnknownTypeHandling = unknownTypeHandling,
438444
UnmappedMemberHandling = unmappedMemberHandling,
439445
UseStringEnumConverter = useStringEnumConverter,

src/libraries/System.Text.Json/gen/Model/SourceGenerationOptionsSpec.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public sealed record SourceGenerationOptionsSpec
5252

5353
public required JsonCommentHandling? ReadCommentHandling { get; init; }
5454

55+
public required JsonKnownReferenceHandler? ReferenceHandler { get; init; }
56+
5557
public required JsonUnknownTypeHandling? UnknownTypeHandling { get; init; }
5658

5759
public required JsonUnmappedMemberHandling? UnmappedMemberHandling { get; init; }

src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<Compile Include="..\Common\JsonKebabCaseLowerNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonKebabCaseLowerNamingPolicy.cs" />
4747
<Compile Include="..\Common\JsonKebabCaseUpperNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonKebabCaseUpperNamingPolicy.cs" />
4848
<Compile Include="..\Common\JsonKnownNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonKnownNamingPolicy.cs" />
49+
<Compile Include="..\Common\JsonKnownReferenceHandler.cs" Link="Common\System\Text\Json\Serialization\JsonKnownReferenceHandler.cs" />
4950
<Compile Include="..\Common\JsonNumberHandling.cs" Link="Common\System\Text\Json\Serialization\JsonNumberHandling.cs" />
5051
<Compile Include="..\Common\JsonObjectCreationHandling.cs" Link="Common\System\Text\Json\Serialization\JsonObjectCreationHandling.cs" />
5152
<Compile Include="..\Common\JsonSeparatorNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonSeparatorNamingPolicy.cs" />

src/libraries/System.Text.Json/ref/System.Text.Json.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,12 @@ public enum JsonKnownNamingPolicy
10431043
KebabCaseLower = 4,
10441044
KebabCaseUpper = 5,
10451045
}
1046+
public enum JsonKnownReferenceHandler
1047+
{
1048+
Unspecified = 0,
1049+
Preserve = 1,
1050+
IgnoreCycles = 2,
1051+
}
10461052
public sealed partial class JsonNumberEnumConverter<TEnum> : System.Text.Json.Serialization.JsonConverterFactory where TEnum : struct, System.Enum
10471053
{
10481054
public JsonNumberEnumConverter() { }
@@ -1143,6 +1149,7 @@ public JsonSourceGenerationOptionsAttribute(System.Text.Json.JsonSerializerDefau
11431149
public bool PropertyNameCaseInsensitive { get { throw null; } set { } }
11441150
public System.Text.Json.Serialization.JsonKnownNamingPolicy PropertyNamingPolicy { get { throw null; } set { } }
11451151
public System.Text.Json.JsonCommentHandling ReadCommentHandling { get { throw null; } set { } }
1152+
public System.Text.Json.Serialization.JsonKnownReferenceHandler ReferenceHandler { get { throw null; } set { } }
11461153
public bool RespectNullableAnnotations { get { throw null; } set { } }
11471154
public bool RespectRequiredConstructorParameters { get { throw null; } set { } }
11481155
public System.Text.Json.Serialization.JsonUnknownTypeHandling UnknownTypeHandling { get { throw null; } set { } }

src/libraries/System.Text.Json/src/System.Text.Json.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
@@ -33,9 +33,9 @@ The System.Text.Json library is built-in as part of the shared framework in .NET
3333
<Compile Include="..\Common\JsonKebabCaseLowerNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonKebabCaseLowerNamingPolicy.cs" />
3434
<Compile Include="..\Common\JsonKebabCaseUpperNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonKebabCaseUpperNamingPolicy.cs" />
3535
<Compile Include="..\Common\JsonKnownNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonKnownNamingPolicy.cs" />
36+
<Compile Include="..\Common\JsonKnownReferenceHandler.cs" Link="Common\System\Text\Json\Serialization\JsonKnownReferenceHandler.cs" />
3637
<Compile Include="..\Common\JsonNumberHandling.cs" Link="Common\System\Text\Json\Serialization\JsonNumberHandling.cs" />
3738
<Compile Include="..\Common\JsonObjectCreationHandling.cs" Link="Common\System\Text\Json\Serialization\JsonObjectCreationHandling.cs" />
38-
<Compile Include="..\Common\JsonUnmappedMemberHandling.cs" Link="Common\System\Text\Json\Serialization\JsonUnmappedMemberHandling.cs" />
3939
<Compile Include="..\Common\JsonSeparatorNamingPolicy.cs" Link="Common\System\Text\Json\Serialization\JsonSeparatorNamingPolicy.cs" />
4040
<Compile Include="..\Common\JsonSerializableAttribute.cs" Link="Common\System\Text\Json\Serialization\JsonSerializableAttribute.cs" />
4141
<Compile Include="..\Common\JsonSerializerDefaults.cs" Link="Common\System\Text\Json\Serialization\JsonSerializerDefaults.cs" />
@@ -44,6 +44,7 @@ The System.Text.Json library is built-in as part of the shared framework in .NET
4444
<Compile Include="..\Common\JsonSourceGenerationMode.cs" Link="Common\System\Text\Json\Serialization\JsonSourceGenerationMode.cs" />
4545
<Compile Include="..\Common\JsonSourceGenerationOptionsAttribute.cs" Link="Common\System\Text\Json\Serialization\JsonSourceGenerationOptionsAttribute.cs" />
4646
<Compile Include="..\Common\JsonUnknownTypeHandling.cs" Link="Common\System\Text\Json\Serialization\JsonUnknownTypeHandling.cs" />
47+
<Compile Include="..\Common\JsonUnmappedMemberHandling.cs" Link="Common\System\Text\Json\Serialization\JsonUnmappedMemberHandling.cs" />
4748
<Compile Include="..\Common\ReflectionExtensions.cs" Link="Common\System\Text\Json\Serialization\ReflectionExtensions.cs" />
4849
<Compile Include="..\Common\ThrowHelper.cs" Link="Common\System\Text\Json\ThrowHelper.cs" />
4950
<Compile Include="System\Runtime\InteropServices\JsonMarshal.cs" />
@@ -295,7 +296,6 @@ The System.Text.Json library is built-in as part of the shared framework in .NET
295296
<Compile Include="System\Text\Json\Serialization\ReadStackFrame.cs" />
296297
<Compile Include="System\Text\Json\Serialization\ReferenceHandler.cs" />
297298
<Compile Include="System\Text\Json\Serialization\ReferenceHandlerOfT.cs" />
298-
<Compile Include="System\Text\Json\Serialization\ReferenceHandlingStrategy.cs" />
299299
<Compile Include="System\Text\Json\Serialization\ReferenceResolver.cs" />
300300
<Compile Include="System\Text\Json\Serialization\StackFrameObjectState.cs" />
301301
<Compile Include="System\Text\Json\Serialization\StackFramePropertyState.cs" />

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/JsonCollectionConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ internal override bool OnTryRead(
182182
if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0)
183183
{
184184
Debug.Assert(state.ReferenceId != null);
185-
Debug.Assert(options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.Preserve);
185+
Debug.Assert(options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Preserve);
186186
Debug.Assert(state.Current.ReturnValue is TCollection);
187187
state.ReferenceResolver.AddReference(state.ReferenceId, state.Current.ReturnValue);
188188
state.ReferenceId = null;

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/JsonDictionaryConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ internal sealed override bool OnTryRead(
205205
if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0)
206206
{
207207
Debug.Assert(state.ReferenceId != null);
208-
Debug.Assert(options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.Preserve);
208+
Debug.Assert(options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Preserve);
209209
Debug.Assert(state.Current.ReturnValue is TDictionary);
210210
state.ReferenceResolver.AddReference(state.ReferenceId, state.Current.ReturnValue);
211211
state.ReferenceId = null;

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert,
117117
JsonElement element = JsonElement.ParseValue(ref reader);
118118

119119
// Edge case where we want to lookup for a reference when parsing into typeof(object)
120-
if (options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.Preserve &&
120+
if (options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Preserve &&
121121
JsonSerializer.TryHandleReferenceFromJsonElement(ref reader, ref state, element, out referenceValue))
122122
{
123123
value = referenceValue;
@@ -134,7 +134,7 @@ internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert,
134134

135135
JsonNode? node = JsonNodeConverter.Instance.Read(ref reader, typeToConvert, options);
136136

137-
if (options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.Preserve &&
137+
if (options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Preserve &&
138138
JsonSerializer.TryHandleReferenceFromJsonNode(ref reader, ref state, node, out referenceValue))
139139
{
140140
value = referenceValue;

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectDefaultConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert,
125125
if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0)
126126
{
127127
Debug.Assert(state.ReferenceId != null);
128-
Debug.Assert(options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.Preserve);
128+
Debug.Assert(options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Preserve);
129129
state.ReferenceResolver.AddReference(state.ReferenceId, obj);
130130
state.ReferenceId = null;
131131
}

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ internal sealed override bool OnTryRead(ref Utf8JsonReader reader, Type typeToCo
207207
if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0)
208208
{
209209
Debug.Assert(state.ReferenceId != null);
210-
Debug.Assert(options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.Preserve);
210+
Debug.Assert(options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Preserve);
211211
state.ReferenceResolver.AddReference(state.ReferenceId, obj);
212212
state.ReferenceId = null;
213213
}

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/IgnoreReferenceHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace System.Text.Json.Serialization
55
{
66
internal sealed class IgnoreReferenceHandler : ReferenceHandler
77
{
8-
public IgnoreReferenceHandler() => HandlingStrategy = ReferenceHandlingStrategy.IgnoreCycles;
8+
public IgnoreReferenceHandler() => HandlingStrategy = JsonKnownReferenceHandler.IgnoreCycles;
99

1010
public override ReferenceResolver CreateResolver() => new IgnoreReferenceResolver();
1111
}

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverter.MetadataHandling.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ internal bool TryHandleSerializedObjectReference(Utf8JsonWriter writer, object v
143143

144144
switch (options.ReferenceHandlingStrategy)
145145
{
146-
case ReferenceHandlingStrategy.IgnoreCycles:
146+
case JsonKnownReferenceHandler.IgnoreCycles:
147147
ReferenceResolver resolver = state.ReferenceResolver;
148148
if (resolver.ContainsReferenceForCycleDetection(value))
149149
{
@@ -158,7 +158,7 @@ internal bool TryHandleSerializedObjectReference(Utf8JsonWriter writer, object v
158158
state.Current.IsPushedReferenceForCycleDetection = state.CurrentDepth > 0;
159159
break;
160160

161-
case ReferenceHandlingStrategy.Preserve:
161+
case JsonKnownReferenceHandler.Preserve:
162162
bool canHaveIdMetadata = polymorphicConverter?.CanHaveMetadata ?? CanHaveMetadata;
163163
if (canHaveIdMetadata && JsonSerializer.TryGetReferenceForValue(value, ref state, writer))
164164
{

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ value is not null &&
382382
ResolvePolymorphicConverter(value, jsonTypeInfo, options, ref state) :
383383
null;
384384

385-
if (!isContinuation && options.ReferenceHandlingStrategy != ReferenceHandlingStrategy.None &&
385+
if (!isContinuation && options.ReferenceHandlingStrategy != JsonKnownReferenceHandler.Unspecified &&
386386
TryHandleSerializedObjectReference(writer, value, options, polymorphicConverter, ref state))
387387
{
388388
// The reference handler wrote reference metadata, serialization complete.

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ options.Encoder is null &&
6363
// Disallow custom number handling we'd need to honor when writing.
6464
// AllowReadingFromString and Strict are fine since there's no action to take when writing.
6565
!JsonHelpers.RequiresSpecialNumberHandlingOnWrite(options.NumberHandling) &&
66-
options.ReferenceHandlingStrategy == ReferenceHandlingStrategy.None &&
66+
options.ReferenceHandlingStrategy == JsonKnownReferenceHandler.Unspecified &&
6767
#pragma warning disable SYSLIB0020
6868
!options.IgnoreNullValues && // This property is obsolete.
6969
#pragma warning restore SYSLIB0020

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ public ReferenceHandler? ReferenceHandler
753753
{
754754
VerifyMutable();
755755
_referenceHandler = value;
756-
ReferenceHandlingStrategy = value?.HandlingStrategy ?? ReferenceHandlingStrategy.None;
756+
ReferenceHandlingStrategy = value?.HandlingStrategy ?? JsonKnownReferenceHandler.Unspecified;
757757
}
758758
}
759759

@@ -853,7 +853,7 @@ internal bool CanUseFastPathSerializationLogic
853853
private bool? _canUseFastPathSerializationLogic;
854854

855855
// The cached value used to determine if ReferenceHandler should use Preserve or IgnoreCycles semantics or None of them.
856-
internal ReferenceHandlingStrategy ReferenceHandlingStrategy = ReferenceHandlingStrategy.None;
856+
internal JsonKnownReferenceHandler ReferenceHandlingStrategy = JsonKnownReferenceHandler.Unspecified;
857857

858858
/// <summary>
859859
/// Specifies whether the current instance has been locked for user modification.

0 commit comments

Comments
 (0)