System\Text\Json\Serialization\JsonUnionTypeStructuralClassifier.cs (28)
92Dictionary<JsonValueType, Type> shapeBasedCases = new();
107shapeBasedCases.TryGetValue(JsonValueType.Object, out Type? nonPocoJsonObjectCaseType);
115JsonValueType.Object);
167Dictionary<JsonValueType, Type> shapeBasedCases,
192JsonValueType valueTypes = typeInfo.Converter.GetSupportedJsonValueTypes(numberHandling);
200ReadOnlySpan<JsonValueType> supportedValueTypes =
202JsonValueType.Object,
203JsonValueType.Array,
204JsonValueType.String,
205JsonValueType.Number,
206JsonValueType.Boolean,
212(JsonValueType.Object |
213JsonValueType.Array |
214JsonValueType.String |
215JsonValueType.Number |
216JsonValueType.Boolean)) is not 0);
218foreach (JsonValueType valueType in supportedValueTypes)
225if (valueType is JsonValueType.Object && isPocoObjectCase)
332private readonly Dictionary<JsonValueType, Type> _shapeBasedCases;
337Dictionary<JsonValueType, Type> shapeBasedCases,
363JsonValueType valueType = reader.TokenType switch
365JsonTokenType.StartObject => JsonValueType.Object,
366JsonTokenType.StartArray => JsonValueType.Array,
367JsonTokenType.String => JsonValueType.String,
368JsonTokenType.Number => JsonValueType.Number,
369JsonTokenType.True or JsonTokenType.False => JsonValueType.Boolean,
370_ => JsonValueType.None,
373if (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)