System\Text\Json\Serialization\JsonUnionTypeStructuralClassifier.cs (28)
95Dictionary<JsonValueType, Type> shapeBasedCases = new();
111shapeBasedCases.TryGetValue(JsonValueType.Object, out Type? nonPocoJsonObjectCaseType);
119JsonValueType.Object);
172Dictionary<JsonValueType, Type> shapeBasedCases,
198JsonValueType valueTypes = typeInfo.Converter.GetSupportedJsonValueTypes(numberHandling);
206ReadOnlySpan<JsonValueType> supportedValueTypes =
208JsonValueType.Object,
209JsonValueType.Array,
210JsonValueType.String,
211JsonValueType.Number,
212JsonValueType.Boolean,
218(JsonValueType.Object |
219JsonValueType.Array |
220JsonValueType.String |
221JsonValueType.Number |
222JsonValueType.Boolean)) is not 0);
224foreach (JsonValueType valueType in supportedValueTypes)
231if (valueType is JsonValueType.Object && isPocoObjectCase)
338private readonly Dictionary<JsonValueType, Type> _shapeBasedCases;
343Dictionary<JsonValueType, Type> shapeBasedCases,
369JsonValueType valueType = reader.TokenType switch
371JsonTokenType.StartObject => JsonValueType.Object,
372JsonTokenType.StartArray => JsonValueType.Array,
373JsonTokenType.String => JsonValueType.String,
374JsonTokenType.Number => JsonValueType.Number,
375JsonTokenType.True or JsonTokenType.False => JsonValueType.Boolean,
376_ => JsonValueType.None,
379if (valueType is JsonValueType.Object && _pocoObjectCases is { Length: > 0 })
System\Text\Json\Serialization\Metadata\JsonTypeInfo.cs (19)
544/// Maps each <see cref="JsonValueType"/> to the first-declared case type that
547internal Dictionary<JsonValueType, Type>? UnionValueTypeMap { get; set; }
550/// Bitmask of <see cref="JsonValueType"/> shapes that two or more declared case types both
553/// <see cref="JsonValueType.None"/> means no ambiguous shapes were detected.
555internal JsonValueType UnionAmbiguousValueTypes { get; set; }
1164var map = new Dictionary<JsonValueType, Type>();
1165JsonValueType ambiguousValueTypes = JsonValueType.None;
1179JsonValueType valueTypes = converter.GetSupportedJsonValueTypes(effectiveNumberHandling);
1188JsonValueType valueTypes,
1190Dictionary<JsonValueType, Type> map,
1191ref JsonValueType ambiguousValueTypes)
1193ReadOnlySpan<JsonValueType> allValueTypes =
1195JsonValueType.Object,
1196JsonValueType.Array,
1197JsonValueType.String,
1198JsonValueType.Number,
1199JsonValueType.Boolean,
1202foreach (JsonValueType valueType in allValueTypes)