< Summary

Line coverage
76%
Covered lines: 362
Uncovered lines: 109
Coverable lines: 471
Total lines: 943
Line coverage: 76.8%
Branch coverage
61%
Covered branches: 128
Total branches: 208
Branch coverage: 61.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
File 1: GetDefaultFactoryConverters()100%11100%
File 1: GetDefaultSimpleConverters()100%11100%
File 1: GetBuiltInConverter(...)100%1010100%
File 1: TryGetDefaultSimpleConverter(...)0%220%
File 1: GetCustomConverterForMember(...)66.66%66100%
File 1: GetConverterForType(...)80%101088.88%
File 1: GetConverterFromAttribute(...)36.36%222241.93%
File 2: .ctor()100%110%
File 2: .ctor(...)100%11100%
File 2: GetTypeInfo(...)25%4464.7%
File 2: CreateJsonTypeInfo(...)100%11100%
File 2: .ctor(...)100%110%
File 2: OnCollectionModifying()0%220%
File 2: System.Text.Json.Serialization.Metadata.IBuiltInJsonTypeInfoResolver.IsCompatibleWithOptions(...)50%66100%
File 3: ClearMemberAccessorCaches()0%220%
File 3: CreateTypeInfoCore(...)70%202072.72%
File 3: PopulateProperties(...)80%101087.5%
File 3: AddMembersDeclaredBySuperType(...)66.66%242471.42%
File 3: AddMember(...)50%2275%
File 3: CreatePropertyInfo(...)33.33%6658.82%
File 3: GetNumberHandlingForType(...)50%22100%
File 3: GetObjectCreationHandlingForType(...)50%22100%
File 3: GetUnmappedMemberHandling(...)50%22100%
File 3: PropertyIsOverriddenAndIgnored(...)62.5%88100%
File 3: PopulateParameterInfoValues(...)75%4488%
File 3: PopulatePropertyInfo(...)50%6682.6%
File 3: DeterminePropertyPolicies(...)50%66100%
File 3: DeterminePropertyName(...)50%6655.55%
File 3: DeterminePropertyIsRequired(...)50%44100%
File 3: DeterminePropertyAccessors(...)61.11%181865.21%
File 3: DetermineCreateObjectDelegate(...)100%66100%
File 3: DeterminePropertyNullability(...)75%4473.33%
File 3: DetermineParameterNullability(...)100%22100%

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Converters.cs

#LineLine coverage
 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
 4using System.Collections.Generic;
 5using System.Diagnostics;
 6using System.Diagnostics.CodeAnalysis;
 7using System.Reflection;
 8using System.Text.Json.Reflection;
 9using System.Text.Json.Serialization.Converters;
 10
 11namespace System.Text.Json.Serialization.Metadata
 12{
 13    public partial class DefaultJsonTypeInfoResolver
 14    {
 15        private static Dictionary<Type, JsonConverter>? s_defaultSimpleConverters;
 16        private static JsonConverterFactory[]? s_defaultFactoryConverters;
 17
 18        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 19        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 20        private static JsonConverterFactory[] GetDefaultFactoryConverters()
 121        {
 122            return
 123            [
 124                // Check for disallowed types.
 125                new UnsupportedTypeConverterFactory(),
 126                // Nullable converter should always be next since it forwards to any nullable type.
 127                new NullableConverterFactory(),
 128                new EnumConverterFactory(),
 129                new JsonNodeConverterFactory(),
 130                new FSharpTypeConverterFactory(),
 131                new MemoryConverterFactory(),
 132                // IAsyncEnumerable takes precedence over IEnumerable.
 133                new IAsyncEnumerableConverterFactory(),
 134                // IEnumerable should always be second to last since they can convert any IEnumerable.
 135                new IEnumerableConverterFactory(),
 136                // Object should always be last since it converts any type.
 137                new ObjectConverterFactory()
 138            ];
 139        }
 40
 41        private static Dictionary<Type, JsonConverter> GetDefaultSimpleConverters()
 142        {
 43            const int NumberOfSimpleConverters = 31;
 144            var converters = new Dictionary<Type, JsonConverter>(NumberOfSimpleConverters);
 45
 46            // Use a dictionary for simple converters.
 47            // When adding to this, update NumberOfSimpleConverters above.
 148            Add(JsonMetadataServices.BooleanConverter);
 149            Add(JsonMetadataServices.ByteConverter);
 150            Add(JsonMetadataServices.ByteArrayConverter);
 151            Add(JsonMetadataServices.CharConverter);
 152            Add(JsonMetadataServices.DateTimeConverter);
 153            Add(JsonMetadataServices.DateTimeOffsetConverter);
 54#if NET
 155            Add(JsonMetadataServices.DateOnlyConverter);
 156            Add(JsonMetadataServices.TimeOnlyConverter);
 157            Add(JsonMetadataServices.HalfConverter);
 58#endif
 159            Add(JsonMetadataServices.DoubleConverter);
 160            Add(JsonMetadataServices.DecimalConverter);
 161            Add(JsonMetadataServices.GuidConverter);
 162            Add(JsonMetadataServices.Int16Converter);
 163            Add(JsonMetadataServices.Int32Converter);
 164            Add(JsonMetadataServices.Int64Converter);
 165            Add(JsonMetadataServices.JsonElementConverter);
 166            Add(JsonMetadataServices.JsonDocumentConverter);
 167            Add(JsonMetadataServices.MemoryByteConverter);
 168            Add(JsonMetadataServices.ReadOnlyMemoryByteConverter);
 169            Add(JsonMetadataServices.ObjectConverter);
 170            Add(JsonMetadataServices.SByteConverter);
 171            Add(JsonMetadataServices.SingleConverter);
 172            Add(JsonMetadataServices.StringConverter);
 173            Add(JsonMetadataServices.TimeSpanConverter);
 174            Add(JsonMetadataServices.UInt16Converter);
 175            Add(JsonMetadataServices.UInt32Converter);
 176            Add(JsonMetadataServices.UInt64Converter);
 77#if NET
 178            Add(JsonMetadataServices.Int128Converter);
 179            Add(JsonMetadataServices.UInt128Converter);
 80#endif
 181            Add(JsonMetadataServices.UriConverter);
 182            Add(JsonMetadataServices.VersionConverter);
 83
 184            Debug.Assert(converters.Count <= NumberOfSimpleConverters);
 85
 186            return converters;
 87
 88            void Add(JsonConverter converter) =>
 3189                converters.Add(converter.Type!, converter);
 190        }
 91
 92        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 93        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 94        private static JsonConverter GetBuiltInConverter(Type typeToConvert)
 1198595        {
 1198596            s_defaultSimpleConverters ??= GetDefaultSimpleConverters();
 1198597            s_defaultFactoryConverters ??= GetDefaultFactoryConverters();
 98
 1198599            if (s_defaultSimpleConverters.TryGetValue(typeToConvert, out JsonConverter? converter))
 8339100            {
 8339101                return converter;
 102            }
 103            else
 3646104            {
 56928105                foreach (JsonConverterFactory factory in s_defaultFactoryConverters)
 24818106                {
 24818107                    if (factory.CanConvert(typeToConvert))
 3646108                    {
 3646109                        converter = factory;
 3646110                        break;
 111                    }
 21172112                }
 113
 114                // Since the object and IEnumerable converters cover all types, we should have a converter.
 3646115                Debug.Assert(converter != null);
 3646116                return converter;
 117            }
 11985118        }
 119
 120        internal static bool TryGetDefaultSimpleConverter(Type typeToConvert, [NotNullWhen(true)] out JsonConverter? con
 0121        {
 0122            if (s_defaultSimpleConverters is null)
 0123            {
 0124                converter = null;
 0125                return false;
 126            }
 127
 0128            return s_defaultSimpleConverters.TryGetValue(typeToConvert, out converter);
 0129        }
 130
 131        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 132        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 133        private static JsonConverter? GetCustomConverterForMember(Type typeToConvert, MemberInfo memberInfo, JsonSeriali
 7794134        {
 7794135            Debug.Assert(memberInfo is FieldInfo or PropertyInfo);
 7794136            Debug.Assert(typeToConvert != null);
 137
 7794138            JsonConverterAttribute? converterAttribute = memberInfo.GetUniqueCustomAttribute<JsonConverterAttribute>(inh
 7794139            return converterAttribute is null ? null : GetConverterFromAttribute(converterAttribute, typeToConvert, memb
 7794140        }
 141
 142        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 143        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 144        internal static JsonConverter GetConverterForType(Type typeToConvert, JsonSerializerOptions options, bool resolv
 12254145        {
 146            // Priority 1: Attempt to get custom converter from the Converters list.
 12254147            JsonConverter? converter = options.GetConverterFromList(typeToConvert);
 148
 149            // Priority 2: Attempt to get converter from [JsonConverter] on the type being converted.
 12254150            if (resolveJsonConverterAttribute && converter == null)
 12254151            {
 12254152                JsonConverterAttribute? converterAttribute = typeToConvert.GetUniqueCustomAttribute<JsonConverterAttribu
 12254153                if (converterAttribute != null)
 269154                {
 269155                    converter = GetConverterFromAttribute(converterAttribute, typeToConvert: typeToConvert, memberInfo: 
 269156                }
 12254157            }
 158
 159            // Priority 3: Query the built-in converters.
 12254160            converter ??= GetBuiltInConverter(typeToConvert);
 161
 162            // Expand if factory converter & validate.
 12254163            converter = options.ExpandConverterFactory(converter, typeToConvert);
 12254164            if (!converter.Type!.IsInSubtypeRelationshipWith(typeToConvert))
 0165            {
 0166                ThrowHelper.ThrowInvalidOperationException_SerializationConverterNotCompatible(converter.GetType(), type
 167            }
 168
 12254169            JsonSerializerOptions.CheckConverterNullabilityIsSameAsPropertyType(converter, typeToConvert);
 12254170            return converter;
 12254171        }
 172
 173        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 174        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 175        private static JsonConverter GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToCon
 269176        {
 177            JsonConverter? converter;
 178
 269179            Type declaringType = memberInfo?.DeclaringType ?? typeToConvert;
 269180            Type? converterType = converterAttribute.ConverterType;
 269181            if (converterType == null)
 0182            {
 183                // Allow the attribute to create the converter.
 0184                converter = converterAttribute.CreateConverter(typeToConvert);
 0185                if (converter == null)
 0186                {
 0187                    ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(declaringT
 188                }
 0189            }
 190            else
 269191            {
 269192                ConstructorInfo? ctor = converterType.GetConstructor(Type.EmptyTypes);
 269193                if (!typeof(JsonConverter).IsAssignableFrom(converterType) || ctor == null || !ctor.IsPublic)
 0194                {
 0195                    ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(declaringType, m
 196                }
 197
 269198                converter = (JsonConverter)Activator.CreateInstance(converterType)!;
 269199            }
 200
 269201            Debug.Assert(converter != null);
 269202            if (!converter.CanConvert(typeToConvert))
 0203            {
 0204                Type? underlyingType = Nullable.GetUnderlyingType(typeToConvert);
 0205                if (underlyingType != null && converter.CanConvert(underlyingType))
 0206                {
 0207                    if (converter is JsonConverterFactory converterFactory)
 0208                    {
 0209                        converter = converterFactory.GetConverterInternal(underlyingType, options);
 0210                    }
 211
 212                    // Allow nullable handling to forward to the underlying type's converter.
 0213                    return NullableConverterFactory.CreateValueConverter(underlyingType, converter);
 214                }
 215
 0216                ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(declaringType,
 217            }
 218
 269219            return converter;
 269220        }
 221    }
 222}

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.cs

#LineLine coverage
 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
 4using System.Collections.Generic;
 5using System.Diagnostics.CodeAnalysis;
 6using System.Threading;
 7
 8namespace System.Text.Json.Serialization.Metadata
 9{
 10    /// <summary>
 11    /// Defines the default, reflection-based JSON contract resolver used by System.Text.Json.
 12    /// </summary>
 13    /// <remarks>
 14    /// The contract resolver used by <see cref="JsonSerializerOptions.Default"/>.
 15    /// </remarks>
 16    public partial class DefaultJsonTypeInfoResolver : IJsonTypeInfoResolver, IBuiltInJsonTypeInfoResolver
 17    {
 18        private bool _mutable;
 19
 20        /// <summary>
 21        /// Creates a mutable <see cref="DefaultJsonTypeInfoResolver"/> instance.
 22        /// </summary>
 23        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 24        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 025        public DefaultJsonTypeInfoResolver() : this(mutable: true)
 026        {
 027        }
 28
 29        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 30        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 131        private DefaultJsonTypeInfoResolver(bool mutable)
 132        {
 133            _mutable = mutable;
 134        }
 35
 36        /// <summary>
 37        /// Resolves a JSON contract for a given <paramref name="type"/> and <paramref name="options"/> configuration.
 38        /// </summary>
 39        /// <param name="type">The type for which to resolve a JSON contract.</param>
 40        /// <param name="options">A <see cref="JsonSerializerOptions"/> instance used to determine contract configuratio
 41        /// <returns>A <see cref="JsonTypeInfo"/> defining a reflection-derived JSON contract for <paramref name="type"/
 42        /// <exception cref="ArgumentNullException"><paramref name="type"/> or <paramref name="options"/> is <see langwo
 43        /// <remarks>
 44        /// The base implementation of this method will produce a reflection-derived contract
 45        /// and apply any callbacks from the <see cref="Modifiers"/> list.
 46        /// </remarks>
 47        [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
 48            Justification = "The ctor is marked RequiresUnreferencedCode.")]
 49        [UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode",
 50            Justification = "The ctor is marked RequiresDynamicCode.")]
 51        public virtual JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options)
 1225452        {
 1225453            ArgumentNullException.ThrowIfNull(type);
 1225454            ArgumentNullException.ThrowIfNull(options);
 55
 1225456            _mutable = false;
 57
 1225458            JsonTypeInfo.ValidateType(type);
 1225459            JsonTypeInfo typeInfo = CreateJsonTypeInfo(type, options);
 1225460            typeInfo.OriginatingResolver = this;
 61
 62            // We've finished configuring the metadata, brand the instance as user-unmodified.
 63            // This should be the last update operation in the resolver to avoid resetting the flag.
 1225464            typeInfo.IsCustomized = false;
 65
 1225466            if (_modifiers != null)
 067            {
 068                foreach (Action<JsonTypeInfo> modifier in _modifiers)
 069                {
 070                    modifier(typeInfo);
 071                }
 072            }
 73
 1225474            return typeInfo;
 1225475        }
 76
 77        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 78        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 79        private static JsonTypeInfo CreateJsonTypeInfo(Type type, JsonSerializerOptions options)
 1225480        {
 1225481            JsonConverter converter = GetConverterForType(type, options);
 1225482            return CreateTypeInfoCore(type, converter, options);
 1225483        }
 84
 85        /// <summary>
 86        /// Gets a list of user-defined callbacks that can be used to modify the initial contract.
 87        /// </summary>
 88        /// <remarks>
 89        /// The modifier list will be rendered immutable after the first <see cref="GetTypeInfo(Type, JsonSerializerOpti
 90        ///
 91        /// Modifier callbacks are called consecutively in the order in which they are specified in the list.
 92        /// </remarks>
 093        public IList<Action<JsonTypeInfo>> Modifiers => _modifiers ??= new ModifierCollection(this);
 94        private ModifierCollection? _modifiers;
 95
 96        private sealed class ModifierCollection : ConfigurationList<Action<JsonTypeInfo>>
 97        {
 98            private readonly DefaultJsonTypeInfoResolver _resolver;
 99
 0100            public ModifierCollection(DefaultJsonTypeInfoResolver resolver)
 0101            {
 0102                _resolver = resolver;
 0103            }
 104
 0105            public override bool IsReadOnly => !_resolver._mutable;
 106            protected override void OnCollectionModifying()
 0107            {
 0108                if (!_resolver._mutable)
 0109                {
 0110                    ThrowHelper.ThrowInvalidOperationException_DefaultTypeInfoResolverImmutable();
 0111                }
 0112            }
 113        }
 114
 115        bool IBuiltInJsonTypeInfoResolver.IsCompatibleWithOptions(JsonSerializerOptions _)
 116            // Metadata generated by the default resolver is compatible by definition,
 117            // provided that no user extensions have been made on the class.
 269118            => _modifiers is null or { Count: 0 } && GetType() == typeof(DefaultJsonTypeInfoResolver);
 119
 120        internal static DefaultJsonTypeInfoResolver DefaultInstance
 121        {
 122            [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 123            [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 124            get
 682125            {
 682126                if (s_defaultInstance is DefaultJsonTypeInfoResolver result)
 681127                {
 681128                    return result;
 129                }
 130
 1131                var newInstance = new DefaultJsonTypeInfoResolver(mutable: false);
 1132                return Interlocked.CompareExchange(ref s_defaultInstance, newInstance, comparand: null) ?? newInstance;
 682133            }
 134        }
 135
 136        private static DefaultJsonTypeInfoResolver? s_defaultInstance;
 137    }
 138}

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Helpers.cs

#LineLine coverage
 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
 4using System.Collections.Generic;
 5using System.Diagnostics;
 6using System.Diagnostics.CodeAnalysis;
 7using System.Reflection;
 8using System.Runtime.CompilerServices;
 9using System.Text.Json.Reflection;
 10using System.Threading;
 11
 12namespace System.Text.Json.Serialization.Metadata
 13{
 14    public partial class DefaultJsonTypeInfoResolver
 15    {
 16        internal static MemberAccessor MemberAccessor
 17        {
 18            [RequiresUnreferencedCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 19            [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 20            get
 2859121            {
 2859122                return s_memberAccessor ?? Initialize();
 23                static MemberAccessor Initialize()
 124                {
 125                    MemberAccessor value =
 126#if NET
 127                        // if dynamic code isn't supported, fallback to reflection
 128                        RuntimeFeature.IsDynamicCodeSupported ?
 129                            new ReflectionEmitCachingMemberAccessor() :
 130                            new ReflectionMemberAccessor();
 31#elif NETFRAMEWORK
 32                            new ReflectionEmitCachingMemberAccessor();
 33#else
 34                            new ReflectionMemberAccessor();
 35#endif
 136                    return Interlocked.CompareExchange(ref s_memberAccessor, value, null) ?? value;
 137                }
 2859138            }
 39        }
 40
 041        internal static void ClearMemberAccessorCaches() => s_memberAccessor?.Clear();
 42        private static MemberAccessor? s_memberAccessor;
 43
 44        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 45        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 46        private static JsonTypeInfo CreateTypeInfoCore(Type type, JsonConverter converter, JsonSerializerOptions options
 1225447        {
 1225448            JsonTypeInfo typeInfo = JsonTypeInfo.CreateJsonTypeInfo(type, converter, options);
 49
 1225450            if (GetNumberHandlingForType(typeInfo.Type) is { } numberHandling)
 051            {
 052                typeInfo.NumberHandling = numberHandling;
 053            }
 54
 1225455            if (GetObjectCreationHandlingForType(typeInfo.Type) is { } creationHandling)
 056            {
 057                typeInfo.PreferredPropertyObjectCreationHandling = creationHandling;
 058            }
 59
 1225460            if (GetUnmappedMemberHandling(typeInfo.Type) is { } unmappedMemberHandling)
 061            {
 062                typeInfo.UnmappedMemberHandling = unmappedMemberHandling;
 063            }
 64
 1225465            typeInfo.PopulatePolymorphismMetadata();
 1225466            typeInfo.MapInterfaceTypesToCallbacks();
 67
 1225468            Func<object>? createObject = DetermineCreateObjectDelegate(type, converter);
 1225469            typeInfo.SetCreateObjectIfCompatible(createObject);
 1225470            typeInfo.CreateObjectForExtensionDataProperty = createObject;
 71
 1225472            if (typeInfo is { Kind: JsonTypeInfoKind.Object, IsNullable: false })
 129973            {
 129974                NullabilityInfoContext nullabilityCtx = new();
 75
 129976                if (converter.ConstructorIsParameterized)
 74977                {
 78                    // NB parameter metadata must be populated *before* property metadata
 79                    // so that properties can be linked to their associated parameters.
 74980                    PopulateParameterInfoValues(typeInfo, nullabilityCtx);
 74981                }
 82
 129983                PopulateProperties(typeInfo, nullabilityCtx);
 84
 129985                typeInfo.ConstructorAttributeProvider = typeInfo.Converter.ConstructorInfo;
 129986            }
 87
 88            // Plug in any converter configuration -- should be run last.
 1225489            converter.ConfigureJsonTypeInfo(typeInfo, options);
 1225490            converter.ConfigureJsonTypeInfoUsingReflection(typeInfo, options);
 1225491            return typeInfo;
 1225492        }
 93
 94        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 95        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 96        private static void PopulateProperties(JsonTypeInfo typeInfo, NullabilityInfoContext nullabilityCtx)
 129997        {
 129998            Debug.Assert(!typeInfo.IsReadOnly);
 129999            Debug.Assert(typeInfo.Kind is JsonTypeInfoKind.Object);
 100
 101            // SetsRequiredMembersAttribute means that all required members are assigned by constructor and therefore th
 1299102            bool constructorHasSetsRequiredMembersAttribute =
 1299103                typeInfo.Converter.ConstructorInfo?.HasSetsRequiredMembersAttribute() ?? false;
 104
 1299105            JsonTypeInfo.PropertyHierarchyResolutionState state = new(typeInfo.Options);
 106
 107            // Walk the type hierarchy starting from the current type up to the base type(s)
 7794108            foreach (Type currentType in typeInfo.Type.GetSortedTypeHierarchy())
 2598109            {
 2598110                if (currentType == JsonTypeInfo.ObjectType ||
 2598111                    currentType == typeof(ValueType))
 1299112                {
 113                    // Don't process any members for typeof(object) or System.ValueType
 1299114                    break;
 115                }
 116
 1299117                AddMembersDeclaredBySuperType(
 1299118                    typeInfo,
 1299119                    currentType,
 1299120                    nullabilityCtx,
 1299121                    constructorHasSetsRequiredMembersAttribute,
 1299122                    ref state);
 1299123            }
 124
 1299125            if (state.IsPropertyOrderSpecified)
 0126            {
 0127                typeInfo.PropertyList.SortProperties();
 0128            }
 1299129        }
 130
 131        private const BindingFlags AllInstanceMembers =
 132            BindingFlags.Instance |
 133            BindingFlags.Public |
 134            BindingFlags.NonPublic |
 135            BindingFlags.DeclaredOnly;
 136
 137
 138        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 139        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 140        private static void AddMembersDeclaredBySuperType(
 141            JsonTypeInfo typeInfo,
 142            Type currentType,
 143            NullabilityInfoContext nullabilityCtx,
 144            bool constructorHasSetsRequiredMembersAttribute,
 145            ref JsonTypeInfo.PropertyHierarchyResolutionState state)
 1299146        {
 1299147            Debug.Assert(!typeInfo.IsReadOnly);
 1299148            Debug.Assert(currentType.IsAssignableFrom(typeInfo.Type));
 149
 150            // Compiler adds RequiredMemberAttribute to type if any of the members are marked with 'required' keyword.
 1299151            bool shouldCheckMembersForRequiredMemberAttribute =
 1299152                !constructorHasSetsRequiredMembersAttribute && currentType.HasRequiredMemberAttribute();
 153
 20983154            foreach (PropertyInfo propertyInfo in currentType.GetProperties(AllInstanceMembers))
 8543155            {
 156                // Ignore indexers and virtual properties that have overrides that were [JsonIgnore]d.
 8543157                if (propertyInfo.GetIndexParameters().Length > 0 ||
 8543158                    PropertyIsOverriddenAndIgnored(propertyInfo, state.IgnoredProperties))
 0159                {
 0160                    continue;
 161                }
 162
 8543163                bool hasJsonIncludeAttribute = propertyInfo.GetCustomAttribute<JsonIncludeAttribute>(inherit: false) != 
 164
 165                // Only include properties that either have a public getter or a public setter or have the JsonIncludeAt
 8543166                if (propertyInfo.GetMethod?.IsPublic == true ||
 8543167                    propertyInfo.SetMethod?.IsPublic == true ||
 8543168                    hasJsonIncludeAttribute)
 7794169                {
 7794170                    AddMember(
 7794171                        typeInfo,
 7794172                        typeToConvert: propertyInfo.PropertyType,
 7794173                        memberInfo: propertyInfo,
 7794174                        nullabilityCtx,
 7794175                        shouldCheckMembersForRequiredMemberAttribute,
 7794176                        hasJsonIncludeAttribute,
 7794177                        ref state);
 7794178                }
 8543179            }
 180
 19485181            foreach (FieldInfo fieldInfo in currentType.GetFields(AllInstanceMembers))
 7794182            {
 7794183                bool hasJsonIncludeAttribute = fieldInfo.GetCustomAttribute<JsonIncludeAttribute>(inherit: false) != nul
 7794184                if (hasJsonIncludeAttribute || (fieldInfo.IsPublic && typeInfo.Options.IncludeFields))
 0185                {
 0186                    AddMember(
 0187                        typeInfo,
 0188                        typeToConvert: fieldInfo.FieldType,
 0189                        memberInfo: fieldInfo,
 0190                        nullabilityCtx,
 0191                        shouldCheckMembersForRequiredMemberAttribute,
 0192                        hasJsonIncludeAttribute,
 0193                        ref state);
 0194                }
 7794195            }
 1299196        }
 197
 198        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 199        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 200        private static void AddMember(
 201            JsonTypeInfo typeInfo,
 202            Type typeToConvert,
 203            MemberInfo memberInfo,
 204            NullabilityInfoContext nullabilityCtx,
 205            bool shouldCheckForRequiredKeyword,
 206            bool hasJsonIncludeAttribute,
 207            ref JsonTypeInfo.PropertyHierarchyResolutionState state)
 7794208        {
 7794209            JsonPropertyInfo? jsonPropertyInfo = CreatePropertyInfo(typeInfo, typeToConvert, memberInfo, nullabilityCtx,
 7794210            if (jsonPropertyInfo == null)
 0211            {
 212                // ignored invalid property
 0213                return;
 214            }
 215
 7794216            Debug.Assert(jsonPropertyInfo.Name != null);
 7794217            typeInfo.PropertyList.AddPropertyWithConflictResolution(jsonPropertyInfo, ref state);
 7794218        }
 219
 220        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 221        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 222        private static JsonPropertyInfo? CreatePropertyInfo(
 223            JsonTypeInfo typeInfo,
 224            Type typeToConvert,
 225            MemberInfo memberInfo,
 226            NullabilityInfoContext nullabilityCtx,
 227            JsonSerializerOptions options,
 228            bool shouldCheckForRequiredKeyword,
 229            bool hasJsonIncludeAttribute)
 7794230        {
 7794231            JsonIgnoreCondition? ignoreCondition = memberInfo.GetCustomAttribute<JsonIgnoreAttribute>(inherit: false)?.C
 232
 7794233            if (JsonTypeInfo.IsInvalidForSerialization(typeToConvert))
 0234            {
 0235                if (ignoreCondition == JsonIgnoreCondition.Always)
 0236                    return null;
 237
 0238                ThrowHelper.ThrowInvalidOperationException_CannotSerializeInvalidType(typeToConvert, memberInfo.Declarin
 239            }
 240
 241            // Resolve any custom converters on the attribute level.
 242            JsonConverter? customConverter;
 243            try
 7794244            {
 7794245                customConverter = GetCustomConverterForMember(typeToConvert, memberInfo, options);
 7794246            }
 0247            catch (InvalidOperationException) when (ignoreCondition == JsonIgnoreCondition.Always)
 0248            {
 249                // skip property altogether if attribute is invalid and the property is ignored
 0250                return null;
 251            }
 252
 7794253            JsonPropertyInfo jsonPropertyInfo = typeInfo.CreatePropertyUsingReflection(typeToConvert, declaringType: mem
 7794254            PopulatePropertyInfo(jsonPropertyInfo, memberInfo, customConverter, ignoreCondition, nullabilityCtx, shouldC
 7794255            return jsonPropertyInfo;
 7794256        }
 257
 258        private static JsonNumberHandling? GetNumberHandlingForType(Type type)
 12254259        {
 12254260            JsonNumberHandlingAttribute? numberHandlingAttribute = type.GetUniqueCustomAttribute<JsonNumberHandlingAttri
 12254261            return numberHandlingAttribute?.Handling;
 12254262        }
 263
 264        private static JsonObjectCreationHandling? GetObjectCreationHandlingForType(Type type)
 12254265        {
 12254266            JsonObjectCreationHandlingAttribute? creationHandlingAttribute = type.GetUniqueCustomAttribute<JsonObjectCre
 12254267            return creationHandlingAttribute?.Handling;
 12254268        }
 269
 270        private static JsonUnmappedMemberHandling? GetUnmappedMemberHandling(Type type)
 12254271        {
 12254272            JsonUnmappedMemberHandlingAttribute? numberHandlingAttribute = type.GetUniqueCustomAttribute<JsonUnmappedMem
 12254273            return numberHandlingAttribute?.UnmappedMemberHandling;
 12254274        }
 275
 276        private static bool PropertyIsOverriddenAndIgnored(PropertyInfo propertyInfo, Dictionary<string, JsonPropertyInf
 8543277        {
 8543278            return propertyInfo.IsVirtual() &&
 8543279                ignoredMembers?.TryGetValue(propertyInfo.Name, out JsonPropertyInfo? ignoredMember) == true &&
 8543280                ignoredMember.IsVirtual &&
 8543281                propertyInfo.PropertyType == ignoredMember.PropertyType;
 8543282        }
 283
 284        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 285        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 286        private static void PopulateParameterInfoValues(JsonTypeInfo typeInfo, NullabilityInfoContext nullabilityCtx)
 749287        {
 749288            Debug.Assert(typeInfo.Converter.ConstructorInfo != null);
 749289            ParameterInfo[] parameters = typeInfo.Converter.ConstructorInfo.GetParameters();
 749290            int parameterCount = parameters.Length;
 749291            JsonParameterInfoValues[] jsonParameters = new JsonParameterInfoValues[parameterCount];
 292
 10486293            for (int i = 0; i < parameterCount; i++)
 4494294            {
 4494295                ParameterInfo reflectionInfo = parameters[i];
 296
 297                // Trimmed parameter names are reported as null in CoreCLR or "" in Mono.
 4494298                if (string.IsNullOrEmpty(reflectionInfo.Name))
 0299                {
 0300                    Debug.Assert(typeInfo.Converter.ConstructorInfo.DeclaringType != null);
 0301                    ThrowHelper.ThrowNotSupportedException_ConstructorContainsNullParameterNames(typeInfo.Converter.Cons
 302                }
 303
 4494304                JsonParameterInfoValues jsonInfo = new()
 4494305                {
 4494306                    Name = reflectionInfo.Name,
 4494307                    ParameterType = reflectionInfo.ParameterType,
 4494308                    Position = reflectionInfo.Position,
 4494309                    HasDefaultValue = reflectionInfo.HasDefaultValue,
 4494310                    DefaultValue = reflectionInfo.GetDefaultValue(),
 4494311                    IsNullable = DetermineParameterNullability(reflectionInfo, nullabilityCtx) is not NullabilityState.N
 4494312                };
 313
 4494314                jsonParameters[i] = jsonInfo;
 4494315            }
 316
 749317            typeInfo.PopulateParameterInfoValues(jsonParameters);
 749318        }
 319
 320        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 321        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 322        private static void PopulatePropertyInfo(
 323            JsonPropertyInfo jsonPropertyInfo,
 324            MemberInfo memberInfo,
 325            JsonConverter? customConverter,
 326            JsonIgnoreCondition? ignoreCondition,
 327            NullabilityInfoContext nullabilityCtx,
 328            bool shouldCheckForRequiredKeyword,
 329            bool hasJsonIncludeAttribute)
 7794330        {
 7794331            Debug.Assert(jsonPropertyInfo.AttributeProvider == null);
 332
 7794333            switch (jsonPropertyInfo.AttributeProvider = memberInfo)
 334            {
 335                case PropertyInfo propertyInfo:
 7794336                    jsonPropertyInfo.MemberName = propertyInfo.Name;
 7794337                    jsonPropertyInfo.IsVirtual = propertyInfo.IsVirtual();
 7794338                    jsonPropertyInfo.MemberType = MemberTypes.Property;
 7794339                    break;
 340                case FieldInfo fieldInfo:
 0341                    jsonPropertyInfo.MemberName = fieldInfo.Name;
 0342                    jsonPropertyInfo.MemberType = MemberTypes.Field;
 0343                    break;
 344                default:
 0345                    Debug.Fail("Only FieldInfo and PropertyInfo members are supported.");
 346                    break;
 347            }
 348
 7794349            jsonPropertyInfo.CustomConverter = customConverter;
 7794350            DeterminePropertyPolicies(jsonPropertyInfo, memberInfo);
 7794351            DeterminePropertyName(jsonPropertyInfo, memberInfo);
 7794352            DeterminePropertyIsRequired(jsonPropertyInfo, memberInfo, shouldCheckForRequiredKeyword);
 7794353            DeterminePropertyNullability(jsonPropertyInfo, memberInfo, nullabilityCtx);
 354
 7794355            if (ignoreCondition != JsonIgnoreCondition.Always)
 7794356            {
 7794357                jsonPropertyInfo.DetermineReflectionPropertyAccessors(memberInfo, useNonPublicAccessors: hasJsonIncludeA
 7794358            }
 359
 7794360            jsonPropertyInfo.IgnoreCondition = ignoreCondition;
 7794361            jsonPropertyInfo.IsExtensionData = memberInfo.GetCustomAttribute<JsonExtensionDataAttribute>(inherit: false)
 7794362        }
 363
 364        private static void DeterminePropertyPolicies(JsonPropertyInfo propertyInfo, MemberInfo memberInfo)
 7794365        {
 7794366            JsonPropertyOrderAttribute? orderAttr = memberInfo.GetCustomAttribute<JsonPropertyOrderAttribute>(inherit: f
 7794367            propertyInfo.Order = orderAttr?.Order ?? 0;
 368
 7794369            JsonNumberHandlingAttribute? numberHandlingAttr = memberInfo.GetCustomAttribute<JsonNumberHandlingAttribute>
 7794370            propertyInfo.NumberHandling = numberHandlingAttr?.Handling;
 371
 7794372            JsonObjectCreationHandlingAttribute? objectCreationHandlingAttr = memberInfo.GetCustomAttribute<JsonObjectCr
 7794373            propertyInfo.ObjectCreationHandling = objectCreationHandlingAttr?.Handling;
 7794374        }
 375
 376        private static void DeterminePropertyName(JsonPropertyInfo propertyInfo, MemberInfo memberInfo)
 7794377        {
 7794378            JsonPropertyNameAttribute? nameAttribute = memberInfo.GetCustomAttribute<JsonPropertyNameAttribute>(inherit:
 379            string? name;
 7794380            if (nameAttribute != null)
 0381            {
 0382                name = nameAttribute.Name;
 0383            }
 7794384            else if (propertyInfo.Options.PropertyNamingPolicy != null)
 0385            {
 0386                name = propertyInfo.Options.PropertyNamingPolicy.ConvertName(memberInfo.Name);
 0387            }
 388            else
 7794389            {
 7794390                name = memberInfo.Name;
 7794391            }
 392
 7794393            if (name == null)
 0394            {
 0395                ThrowHelper.ThrowInvalidOperationException_SerializerPropertyNameNull(propertyInfo);
 396            }
 397
 7794398            propertyInfo.Name = name;
 7794399        }
 400
 401        private static void DeterminePropertyIsRequired(JsonPropertyInfo propertyInfo, MemberInfo memberInfo, bool shoul
 7794402        {
 7794403            propertyInfo.IsRequired =
 7794404                memberInfo.GetCustomAttribute<JsonRequiredAttribute>(inherit: false) != null
 7794405                || (shouldCheckForRequiredKeyword && memberInfo.HasRequiredMemberAttribute());
 7794406        }
 407
 408        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 409        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 410        internal static void DeterminePropertyAccessors<T>(JsonPropertyInfo<T> jsonPropertyInfo, MemberInfo memberInfo, 
 7794411        {
 7794412            Debug.Assert(memberInfo is FieldInfo or PropertyInfo);
 413
 7794414            switch (memberInfo)
 415            {
 416                case PropertyInfo propertyInfo:
 7794417                    MethodInfo? getMethod = propertyInfo.GetMethod;
 7794418                    if (getMethod != null && (getMethod.IsPublic || useNonPublicAccessors))
 7794419                    {
 7794420                        jsonPropertyInfo.Get = MemberAccessor.CreatePropertyGetter<T>(propertyInfo);
 7794421                    }
 422
 7794423                    MethodInfo? setMethod = propertyInfo.SetMethod;
 7794424                    if (setMethod != null && (setMethod.IsPublic || useNonPublicAccessors))
 7794425                    {
 7794426                        jsonPropertyInfo.Set = MemberAccessor.CreatePropertySetter<T>(propertyInfo);
 7794427                    }
 428
 7794429                    break;
 430
 431                case FieldInfo fieldInfo:
 0432                    Debug.Assert(fieldInfo.IsPublic || useNonPublicAccessors);
 433
 0434                    jsonPropertyInfo.Get = MemberAccessor.CreateFieldGetter<T>(fieldInfo);
 435
 0436                    if (!fieldInfo.IsInitOnly)
 0437                    {
 0438                        jsonPropertyInfo.Set = MemberAccessor.CreateFieldSetter<T>(fieldInfo);
 0439                    }
 440
 0441                    break;
 442
 443                default:
 0444                    Debug.Fail($"Invalid MemberInfo type: {memberInfo.MemberType}");
 445                    break;
 446            }
 7794447        }
 448
 449        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 450        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 451        private static Func<object>? DetermineCreateObjectDelegate(Type type, JsonConverter converter)
 12254452        {
 12254453            ConstructorInfo? defaultCtor = null;
 454
 12254455            if (converter.ConstructorInfo != null && !converter.ConstructorIsParameterized)
 550456            {
 457                // A parameterless constructor has been resolved by the converter
 458                // (e.g. it might be a non-public ctor with JsonConstructorAttribute).
 550459                defaultCtor = converter.ConstructorInfo;
 550460            }
 461
 462            // Fall back to resolving any public constructors on the type.
 12254463            defaultCtor ??= type.GetConstructor(BindingFlags.Public | BindingFlags.Instance, binder: null, Type.EmptyTyp
 464
 12254465            return MemberAccessor.CreateParameterlessConstructor(type, defaultCtor);
 12254466        }
 467
 468        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 469        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 470        private static void DeterminePropertyNullability(JsonPropertyInfo propertyInfo, MemberInfo memberInfo, Nullabili
 7794471        {
 7794472            if (!propertyInfo.PropertyTypeCanBeNull)
 5134473            {
 5134474                return;
 475            }
 476
 477            NullabilityInfo nullabilityInfo;
 2660478            if (propertyInfo.MemberType is MemberTypes.Property)
 2660479            {
 2660480                nullabilityInfo = nullabilityCtx.Create((PropertyInfo)memberInfo);
 2660481            }
 482            else
 0483            {
 0484                Debug.Assert(propertyInfo.MemberType is MemberTypes.Field);
 0485                nullabilityInfo = nullabilityCtx.Create((FieldInfo)memberInfo);
 0486            }
 487
 2660488            propertyInfo.IsGetNullable = nullabilityInfo.ReadState is not NullabilityState.NotNull;
 2660489            propertyInfo.IsSetNullable = nullabilityInfo.WriteState is not NullabilityState.NotNull;
 7794490        }
 491
 492        [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)]
 493        [RequiresDynamicCode(JsonSerializer.SerializationRequiresDynamicCodeMessage)]
 494        private static NullabilityState DetermineParameterNullability(ParameterInfo parameterInfo, NullabilityInfoContex
 4494495        {
 4494496            if (!parameterInfo.ParameterType.IsNullableType())
 2909497            {
 2909498                return NullabilityState.NotNull;
 499            }
 500#if NET8_0
 501            // Workaround for https://github.com/dotnet/runtime/issues/92487
 502            // The fix has been incorporated into .NET 9 (and the polyfilled implementations in netfx).
 503            // Should be removed once .NET 8 support is dropped.
 504            if (parameterInfo.GetGenericParameterDefinition() is { ParameterType: { IsGenericParameter: true } typeParam
 505            {
 506                // Step 1. Look for nullable annotations on the type parameter.
 507                if (GetNullableFlags(typeParam) is byte[] flags)
 508                {
 509                    return TranslateByte(flags[0]);
 510                }
 511
 512                // Step 2. Look for nullable annotations on the generic method declaration.
 513                if (typeParam.DeclaringMethod != null && GetNullableContextFlag(typeParam.DeclaringMethod) is byte flag)
 514                {
 515                    return TranslateByte(flag);
 516                }
 517
 518                // Step 3. Look for nullable annotations on the generic type declaration.
 519                if (GetNullableContextFlag(typeParam.DeclaringType!) is byte flag2)
 520                {
 521                    return TranslateByte(flag2);
 522                }
 523
 524                // Default to nullable.
 525                return NullabilityState.Nullable;
 526
 527                static byte[]? GetNullableFlags(MemberInfo member)
 528                {
 529                    foreach (CustomAttributeData attr in member.GetCustomAttributesData())
 530                    {
 531                        Type attrType = attr.AttributeType;
 532                        if (attrType.Name == "NullableAttribute" && attrType.Namespace == "System.Runtime.CompilerServic
 533                        {
 534                            foreach (CustomAttributeTypedArgument ctorArg in attr.ConstructorArguments)
 535                            {
 536                                switch (ctorArg.Value)
 537                                {
 538                                    case byte flag:
 539                                        return [flag];
 540                                    case byte[] flags:
 541                                        return flags;
 542                                }
 543                            }
 544                        }
 545                    }
 546
 547                    return null;
 548                }
 549
 550                static byte? GetNullableContextFlag(MemberInfo member)
 551                {
 552                    foreach (CustomAttributeData attr in member.GetCustomAttributesData())
 553                    {
 554                        Type attrType = attr.AttributeType;
 555                        if (attrType.Name == "NullableContextAttribute" && attrType.Namespace == "System.Runtime.Compile
 556                        {
 557                            foreach (CustomAttributeTypedArgument ctorArg in attr.ConstructorArguments)
 558                            {
 559                                if (ctorArg.Value is byte flag)
 560                                {
 561                                    return flag;
 562                                }
 563                            }
 564                        }
 565                    }
 566
 567                    return null;
 568                }
 569
 570                static NullabilityState TranslateByte(byte b) =>
 571                    b switch
 572                    {
 573                        1 => NullabilityState.NotNull,
 574                        2 => NullabilityState.Nullable,
 575                        _ => NullabilityState.Unknown
 576                    };
 577            }
 578#endif
 1585579            NullabilityInfo nullability = nullabilityCtx.Create(parameterInfo);
 1585580            return nullability.WriteState;
 4494581        }
 582    }
 583}

Methods/Properties

GetDefaultFactoryConverters()
GetDefaultSimpleConverters()
GetBuiltInConverter(System.Type)
TryGetDefaultSimpleConverter(System.Type,System.Text.Json.Serialization.JsonConverter&)
GetCustomConverterForMember(System.Type,System.Reflection.MemberInfo,System.Text.Json.JsonSerializerOptions)
GetConverterForType(System.Type,System.Text.Json.JsonSerializerOptions,System.Boolean)
GetConverterFromAttribute(System.Text.Json.Serialization.JsonConverterAttribute,System.Type,System.Reflection.MemberInfo,System.Text.Json.JsonSerializerOptions)
.ctor()
.ctor(System.Boolean)
GetTypeInfo(System.Type,System.Text.Json.JsonSerializerOptions)
CreateJsonTypeInfo(System.Type,System.Text.Json.JsonSerializerOptions)
Modifiers()
.ctor(System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver)
IsReadOnly()
OnCollectionModifying()
System.Text.Json.Serialization.Metadata.IBuiltInJsonTypeInfoResolver.IsCompatibleWithOptions(System.Text.Json.JsonSerializerOptions)
DefaultInstance()
MemberAccessor()
ialize()
ClearMemberAccessorCaches()
CreateTypeInfoCore(System.Type,System.Text.Json.Serialization.JsonConverter,System.Text.Json.JsonSerializerOptions)
PopulateProperties(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Reflection.NullabilityInfoContext)
AddMembersDeclaredBySuperType(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Type,System.Reflection.NullabilityInfoContext,System.Boolean,System.Text.Json.Serialization.Metadata.JsonTypeInfo/PropertyHierarchyResolutionState&)
AddMember(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Type,System.Reflection.MemberInfo,System.Reflection.NullabilityInfoContext,System.Boolean,System.Boolean,System.Text.Json.Serialization.Metadata.JsonTypeInfo/PropertyHierarchyResolutionState&)
CreatePropertyInfo(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Type,System.Reflection.MemberInfo,System.Reflection.NullabilityInfoContext,System.Text.Json.JsonSerializerOptions,System.Boolean,System.Boolean)
GetNumberHandlingForType(System.Type)
GetObjectCreationHandlingForType(System.Type)
GetUnmappedMemberHandling(System.Type)
PropertyIsOverriddenAndIgnored(System.Reflection.PropertyInfo,System.Collections.Generic.Dictionary`2<System.String,System.Text.Json.Serialization.Metadata.JsonPropertyInfo>)
PopulateParameterInfoValues(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Reflection.NullabilityInfoContext)
PopulatePropertyInfo(System.Text.Json.Serialization.Metadata.JsonPropertyInfo,System.Reflection.MemberInfo,System.Text.Json.Serialization.JsonConverter,System.Nullable`1<System.Text.Json.Serialization.JsonIgnoreCondition>,System.Reflection.NullabilityInfoContext,System.Boolean,System.Boolean)
DeterminePropertyPolicies(System.Text.Json.Serialization.Metadata.JsonPropertyInfo,System.Reflection.MemberInfo)
DeterminePropertyName(System.Text.Json.Serialization.Metadata.JsonPropertyInfo,System.Reflection.MemberInfo)
DeterminePropertyIsRequired(System.Text.Json.Serialization.Metadata.JsonPropertyInfo,System.Reflection.MemberInfo,System.Boolean)
DeterminePropertyAccessors(System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1<T>,System.Reflection.MemberInfo,System.Boolean)
DetermineCreateObjectDelegate(System.Type,System.Text.Json.Serialization.JsonConverter)
DeterminePropertyNullability(System.Text.Json.Serialization.Metadata.JsonPropertyInfo,System.Reflection.MemberInfo,System.Reflection.NullabilityInfoContext)
DetermineParameterNullability(System.Reflection.ParameterInfo,System.Reflection.NullabilityInfoContext)