< Summary

Line coverage
9%
Covered lines: 35
Uncovered lines: 347
Coverable lines: 382
Total lines: 1200
Line coverage: 9.1%
Branch coverage
24%
Covered branches: 35
Total branches: 142
Branch coverage: 24.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
File 1: CreateArrayInfo(...)100%110%
File 1: CreateListInfo(...)100%110%
File 1: CreateDictionaryInfo(...)100%110%
File 1: CreateImmutableDictionaryInfo(...)100%110%
File 1: CreateIDictionaryInfo(...)100%110%
File 1: CreateIReadOnlyDictionaryInfo(...)100%110%
File 1: CreateImmutableEnumerableInfo(...)100%110%
File 1: CreateIListInfo(...)100%110%
File 1: CreateISetInfo(...)100%110%
File 1: CreateIReadOnlySetInfo(...)100%110%
File 1: CreateICollectionInfo(...)100%110%
File 1: CreateStackInfo(...)100%110%
File 1: CreateQueueInfo(...)100%110%
File 1: CreateConcurrentStackInfo(...)100%110%
File 1: CreateConcurrentQueueInfo(...)100%110%
File 1: CreateIEnumerableInfo(...)100%110%
File 1: CreateIAsyncEnumerableInfo(...)100%110%
File 1: CreateStackInfo(...)100%110%
File 1: CreateQueueInfo(...)100%110%
File 1: CreateStackOrQueueInfo(...)100%110%
File 1: CreateMemoryInfo(...)100%110%
File 1: CreateReadOnlyMemoryInfo(...)100%110%
File 2: GetUnsupportedTypeConverter()100%110%
File 2: GetEnumConverter(...)100%110%
File 2: GetNullableConverter(...)100%110%
File 2: GetNullableConverter(...)100%110%
File 2: GetTypedConverter(...)0%220%
File 3: CreatePropertyInfo(...)0%880%
File 3: CreateObjectInfo(...)100%110%
File 3: CreateUnionInfo(...)0%220%
File 3: CreateValueInfo(...)100%110%
File 4: CreateCore(...)100%110%
File 4: CreateCore(...)0%440%
File 4: CreateCore(...)0%220%
File 4: GetConverter(...)0%440%
File 4: PopulatePolymorphismMetadata(...)0%10100%
File 4: PopulateParameterInfoValues(...)0%440%
File 4: PopulateProperties(...)0%18180%
File 4: CreatePropertyInfoCore(...)0%440%
File 4: DeterminePropertyName(...)0%660%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Collections.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;
 5using System.Collections.Concurrent;
 6using System.Collections.Generic;
 7using System.Text.Json.Serialization.Converters;
 8
 9namespace System.Text.Json.Serialization.Metadata
 10{
 11    public static partial class JsonMetadataServices
 12    {
 13        /// <summary>
 14        /// Creates serialization metadata for an array.
 15        /// </summary>
 16        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 17        /// <param name="options">The <see cref="JsonSerializerOptions"/> to use.</param>
 18        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 19        /// <returns>Serialization metadata for the given type.</returns>
 20        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 21        public static JsonTypeInfo<TElement[]> CreateArrayInfo<TElement>(JsonSerializerOptions options, JsonCollectionIn
 022            => CreateCore(
 023                options,
 024                collectionInfo,
 025                new ArrayConverter<TElement[], TElement>());
 26
 27        /// <summary>
 28        /// Creates serialization metadata for types assignable to <see cref="List{T}"/>.
 29        /// </summary>
 30        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 31        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 32        /// <param name="options">The <see cref="JsonSerializerOptions"/> to use.</param>
 33        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 34        /// <returns>Serialization metadata for the given type.</returns>
 35        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 36        public static JsonTypeInfo<TCollection> CreateListInfo<TCollection, TElement>(
 37            JsonSerializerOptions options,
 38            JsonCollectionInfoValues<TCollection> collectionInfo)
 39            where TCollection : List<TElement>
 040            => CreateCore(
 041                options,
 042                collectionInfo,
 043                new ListOfTConverter<TCollection, TElement>());
 44
 45        /// <summary>
 46        /// Creates serialization metadata for types assignable to <see cref="Dictionary{TKey, TValue}"/>.
 47        /// </summary>
 48        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 49        /// <typeparam name="TKey">The generic definition of the key type.</typeparam>
 50        /// <typeparam name="TValue">The generic definition of the value type.</typeparam>
 51        /// <param name="options"></param>
 52        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 53        /// <returns>Serialization metadata for the given type.</returns>
 54        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 55        public static JsonTypeInfo<TCollection> CreateDictionaryInfo<TCollection, TKey, TValue>(
 56            JsonSerializerOptions options,
 57            JsonCollectionInfoValues<TCollection> collectionInfo)
 58            where TCollection : Dictionary<TKey, TValue>
 59            where TKey : notnull
 060            => CreateCore(
 061                options,
 062                collectionInfo,
 063                new DictionaryOfTKeyTValueConverter<TCollection, TKey, TValue>());
 64
 65
 66#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
 67        /// <summary>
 68        /// Creates serialization metadata for <see cref="System.Collections.Immutable.ImmutableDictionary{TKey, TValue}
 69        /// types assignable to <see cref="System.Collections.Immutable.IImmutableDictionary{TKey, TValue}"/>.
 70        /// </summary>
 71        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 72        /// <typeparam name="TKey">The generic definition of the key type.</typeparam>
 73        /// <typeparam name="TValue">The generic definition of the value type.</typeparam>
 74        /// <param name="options"></param>
 75        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 76        /// <param name="createRangeFunc">A method to create an immutable dictionary instance.</param>
 77        /// <returns>Serialization metadata for the given type.</returns>
 78        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 79#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
 80        public static JsonTypeInfo<TCollection> CreateImmutableDictionaryInfo<TCollection, TKey, TValue>(
 81            JsonSerializerOptions options,
 82            JsonCollectionInfoValues<TCollection> collectionInfo,
 83            Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection> createRangeFunc)
 84            where TCollection : IReadOnlyDictionary<TKey, TValue>
 85            where TKey : notnull
 086        {
 087            ArgumentNullException.ThrowIfNull(createRangeFunc);
 88
 089            return CreateCore(
 090                options,
 091                collectionInfo,
 092                new ImmutableDictionaryOfTKeyTValueConverter<TCollection, TKey, TValue>(),
 093                createObjectWithArgs: createRangeFunc);
 094        }
 95
 96        /// <summary>
 97        /// Creates serialization metadata for types assignable to <see cref="IDictionary{TKey, TValue}"/>.
 98        /// </summary>
 99        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 100        /// <typeparam name="TKey">The generic definition of the key type.</typeparam>
 101        /// <typeparam name="TValue">The generic definition of the value type.</typeparam>
 102        /// <param name="options"></param>
 103        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 104        /// <returns>Serialization metadata for the given type.</returns>
 105        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 106        public static JsonTypeInfo<TCollection> CreateIDictionaryInfo<TCollection, TKey, TValue>(
 107            JsonSerializerOptions options,
 108            JsonCollectionInfoValues<TCollection> collectionInfo)
 109            where TCollection : IDictionary<TKey, TValue>
 110            where TKey : notnull
 0111            => CreateCore(
 0112                options,
 0113                collectionInfo,
 0114                new IDictionaryOfTKeyTValueConverter<TCollection, TKey, TValue>());
 115
 116        /// <summary>
 117        /// Creates serialization metadata for types assignable to <see cref="IReadOnlyDictionary{TKey, TValue}"/>.
 118        /// </summary>
 119        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 120        /// <typeparam name="TKey">The generic definition of the key type.</typeparam>
 121        /// <typeparam name="TValue">The generic definition of the value type.</typeparam>
 122        /// <param name="options"></param>
 123        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 124        /// <returns>Serialization metadata for the given type.</returns>
 125        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 126        public static JsonTypeInfo<TCollection> CreateIReadOnlyDictionaryInfo<TCollection, TKey, TValue>(
 127            JsonSerializerOptions options,
 128            JsonCollectionInfoValues<TCollection> collectionInfo)
 129            where TCollection : IReadOnlyDictionary<TKey, TValue>
 130            where TKey : notnull
 0131            => CreateCore(
 0132                options,
 0133                collectionInfo,
 0134                new IReadOnlyDictionaryOfTKeyTValueConverter<TCollection, TKey, TValue>());
 135
 136        /// <summary>
 137        /// Creates serialization metadata for non-dictionary immutable collection types.
 138        /// </summary>
 139        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 140        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 141        /// <param name="options"></param>
 142        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 143        /// <param name="createRangeFunc">A method to create an immutable dictionary instance.</param>
 144        /// <returns>Serialization metadata for the given type.</returns>
 145        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 146        public static JsonTypeInfo<TCollection> CreateImmutableEnumerableInfo<TCollection, TElement>(
 147            JsonSerializerOptions options,
 148            JsonCollectionInfoValues<TCollection> collectionInfo,
 149            Func<IEnumerable<TElement>, TCollection> createRangeFunc)
 150            where TCollection : IEnumerable<TElement>
 0151        {
 0152            ArgumentNullException.ThrowIfNull(createRangeFunc);
 153
 0154            return CreateCore(
 0155                options,
 0156                collectionInfo,
 0157                new ImmutableEnumerableOfTConverter<TCollection, TElement>(),
 0158                createObjectWithArgs: createRangeFunc);
 0159        }
 160
 161        /// <summary>
 162        /// Creates serialization metadata for types assignable to <see cref="IList"/>.
 163        /// </summary>
 164        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 165        /// <param name="options"></param>
 166        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 167        /// <returns>Serialization metadata for the given type.</returns>
 168        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 169        public static JsonTypeInfo<TCollection> CreateIListInfo<TCollection>(
 170            JsonSerializerOptions options,
 171            JsonCollectionInfoValues<TCollection> collectionInfo)
 172            where TCollection : IList
 0173            => CreateCore(
 0174                options,
 0175                collectionInfo,
 0176                new IListConverter<TCollection>());
 177
 178        /// <summary>
 179        /// Creates serialization metadata for types assignable to <see cref="IList{T}"/>.
 180        /// </summary>
 181        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 182        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 183        /// <param name="options"></param>
 184        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 185        /// <returns>Serialization metadata for the given type.</returns>
 186        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 187        public static JsonTypeInfo<TCollection> CreateIListInfo<TCollection, TElement>(
 188            JsonSerializerOptions options,
 189            JsonCollectionInfoValues<TCollection> collectionInfo)
 190            where TCollection : IList<TElement>
 0191            => CreateCore(
 0192                options,
 0193                collectionInfo,
 0194                new IListOfTConverter<TCollection, TElement>());
 195
 196        /// <summary>
 197        /// Creates serialization metadata for types assignable to <see cref="ISet{T}"/>.
 198        /// </summary>
 199        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 200        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 201        /// <param name="options"></param>
 202        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 203        /// <returns>Serialization metadata for the given type.</returns>
 204        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 205        public static JsonTypeInfo<TCollection> CreateISetInfo<TCollection, TElement>(
 206            JsonSerializerOptions options,
 207            JsonCollectionInfoValues<TCollection> collectionInfo)
 208            where TCollection : ISet<TElement>
 0209            => CreateCore(
 0210                options,
 0211                collectionInfo,
 0212                new ISetOfTConverter<TCollection, TElement>());
 213
 214#if NET
 215        /// <summary>
 216        /// Creates serialization metadata for types assignable to <see cref="IReadOnlySet{T}"/>.
 217        /// </summary>
 218        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 219        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 220        /// <param name="options"></param>
 221        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 222        /// <returns>Serialization metadata for the given type.</returns>
 223        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 224        public static JsonTypeInfo<TCollection> CreateIReadOnlySetInfo<TCollection, TElement>(
 225            JsonSerializerOptions options,
 226            JsonCollectionInfoValues<TCollection> collectionInfo)
 227            where TCollection : IReadOnlySet<TElement>
 0228            => CreateCore(
 0229                options,
 0230                collectionInfo,
 0231                new IReadOnlySetOfTConverter<TCollection, TElement>());
 232#endif
 233
 234        /// <summary>
 235        /// Creates serialization metadata for types assignable to <see cref="ICollection{T}"/>.
 236        /// </summary>
 237        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 238        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 239        /// <param name="options"></param>
 240        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 241        /// <returns>Serialization metadata for the given type.</returns>
 242        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 243        public static JsonTypeInfo<TCollection> CreateICollectionInfo<TCollection, TElement>(
 244            JsonSerializerOptions options,
 245            JsonCollectionInfoValues<TCollection> collectionInfo)
 246            where TCollection : ICollection<TElement>
 0247            => CreateCore(
 0248                options,
 0249                collectionInfo,
 0250                new ICollectionOfTConverter<TCollection, TElement>());
 251
 252        /// <summary>
 253        /// Creates serialization metadata for types assignable to <see cref="Stack{T}"/>.
 254        /// </summary>
 255        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 256        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 257        /// <param name="options"></param>
 258        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 259        /// <returns>Serialization metadata for the given type.</returns>
 260        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 261        public static JsonTypeInfo<TCollection> CreateStackInfo<TCollection, TElement>(
 262            JsonSerializerOptions options,
 263            JsonCollectionInfoValues<TCollection> collectionInfo)
 264            where TCollection : Stack<TElement>
 0265            => CreateCore(
 0266                options,
 0267                collectionInfo,
 0268                new StackOfTConverter<TCollection, TElement>());
 269
 270        /// <summary>
 271        /// Creates serialization metadata for types assignable to <see cref="Queue{T}"/>.
 272        /// </summary>
 273        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 274        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 275        /// <param name="options"></param>
 276        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 277        /// <returns>Serialization metadata for the given type.</returns>
 278        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 279        public static JsonTypeInfo<TCollection> CreateQueueInfo<TCollection, TElement>(
 280            JsonSerializerOptions options,
 281            JsonCollectionInfoValues<TCollection> collectionInfo)
 282            where TCollection : Queue<TElement>
 0283            => CreateCore(
 0284                options,
 0285                collectionInfo,
 0286                new QueueOfTConverter<TCollection, TElement>());
 287
 288        /// <summary>
 289        /// Creates serialization metadata for types assignable to <see cref="ConcurrentStack{T}"/>.
 290        /// </summary>
 291        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 292        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 293        /// <param name="options"></param>
 294        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 295        /// <returns>Serialization metadata for the given type.</returns>
 296        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 297        public static JsonTypeInfo<TCollection> CreateConcurrentStackInfo<TCollection, TElement>(
 298            JsonSerializerOptions options,
 299            JsonCollectionInfoValues<TCollection> collectionInfo)
 300            where TCollection : ConcurrentStack<TElement>
 0301            => CreateCore(
 0302                options,
 0303                collectionInfo,
 0304                new ConcurrentStackOfTConverter<TCollection, TElement>());
 305
 306        /// <summary>
 307        /// Creates serialization metadata for types assignable to <see cref="Queue{T}"/>.
 308        /// </summary>
 309        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 310        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 311        /// <param name="options"></param>
 312        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 313        /// <returns>Serialization metadata for the given type.</returns>
 314        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 315        public static JsonTypeInfo<TCollection> CreateConcurrentQueueInfo<TCollection, TElement>(
 316            JsonSerializerOptions options,
 317            JsonCollectionInfoValues<TCollection> collectionInfo)
 318            where TCollection : ConcurrentQueue<TElement>
 0319            => CreateCore(
 0320                options,
 0321                collectionInfo,
 0322                new ConcurrentQueueOfTConverter<TCollection, TElement>());
 323
 324        /// <summary>
 325        /// Creates serialization metadata for types assignable to <see cref="IEnumerable{T}"/>.
 326        /// </summary>
 327        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 328        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 329        /// <param name="options"></param>
 330        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 331        /// <returns>Serialization metadata for the given type.</returns>
 332        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 333        public static JsonTypeInfo<TCollection> CreateIEnumerableInfo<TCollection, TElement>(
 334            JsonSerializerOptions options,
 335            JsonCollectionInfoValues<TCollection> collectionInfo)
 336            where TCollection : IEnumerable<TElement>
 0337            => CreateCore(
 0338                options,
 0339                collectionInfo,
 0340                new IEnumerableOfTConverter<TCollection, TElement>());
 341
 342        /// <summary>
 343        /// Creates serialization metadata for types assignable to <see cref="IAsyncEnumerable{T}"/>.
 344        /// </summary>
 345        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 346        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 347        /// <param name="options"></param>
 348        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 349        /// <returns>Serialization metadata for the given type.</returns>
 350        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 351        public static JsonTypeInfo<TCollection> CreateIAsyncEnumerableInfo<TCollection, TElement>(
 352            JsonSerializerOptions options,
 353            JsonCollectionInfoValues<TCollection> collectionInfo)
 354            where TCollection : IAsyncEnumerable<TElement>
 0355            => CreateCore(
 0356                options,
 0357                collectionInfo,
 0358                new IAsyncEnumerableOfTConverter<TCollection, TElement>());
 359
 360        /// <summary>
 361        /// Creates serialization metadata for types assignable to <see cref="IDictionary"/>.
 362        /// </summary>
 363        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 364        /// <param name="options"></param>
 365        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 366        /// <returns>Serialization metadata for the given type.</returns>
 367        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 368        public static JsonTypeInfo<TCollection> CreateIDictionaryInfo<TCollection>(
 369            JsonSerializerOptions options,
 370            JsonCollectionInfoValues<TCollection> collectionInfo)
 371            where TCollection : IDictionary
 0372            => CreateCore(
 0373                options,
 0374                collectionInfo,
 0375                new IDictionaryConverter<TCollection>());
 376
 377#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
 378        /// <summary>
 379        /// Creates serialization metadata for <see cref="System.Collections.Stack"/> types.
 380        /// </summary>
 381        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 382        /// <param name="options"></param>
 383        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 384        /// <param name="addFunc">A method for adding elements to the collection when using the serializer's code-paths.
 385        /// <returns>Serialization metadata for the given type.</returns>
 386        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 387#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
 388        public static JsonTypeInfo<TCollection> CreateStackInfo<TCollection>(
 389            JsonSerializerOptions options,
 390            JsonCollectionInfoValues<TCollection> collectionInfo,
 391            Action<TCollection, object?> addFunc)
 392            where TCollection : IEnumerable
 0393            => CreateStackOrQueueInfo(options, collectionInfo, addFunc);
 394
 395#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
 396        /// <summary>
 397        /// Creates serialization metadata for <see cref="System.Collections.Queue"/> types.
 398        /// </summary>
 399        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 400        /// <param name="options"></param>
 401        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 402        /// <param name="addFunc">A method for adding elements to the collection when using the serializer's code-paths.
 403        /// <returns>Serialization metadata for the given type.</returns>
 404        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 405#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved
 406        public static JsonTypeInfo<TCollection> CreateQueueInfo<TCollection>(
 407            JsonSerializerOptions options,
 408            JsonCollectionInfoValues<TCollection> collectionInfo,
 409            Action<TCollection, object?> addFunc)
 410            where TCollection : IEnumerable
 0411            => CreateStackOrQueueInfo(options, collectionInfo, addFunc);
 412
 413        private static JsonTypeInfo<TCollection> CreateStackOrQueueInfo<TCollection>(
 414            JsonSerializerOptions options,
 415            JsonCollectionInfoValues<TCollection> collectionInfo,
 416            Action<TCollection, object?> addFunc)
 417            where TCollection : IEnumerable
 0418        {
 0419            ArgumentNullException.ThrowIfNull(addFunc);
 420
 0421            return CreateCore(
 0422                options,
 0423                collectionInfo,
 0424                new StackOrQueueConverter<TCollection>(),
 0425                createObjectWithArgs: null,
 0426                addFunc: addFunc);
 0427        }
 428
 429        /// <summary>
 430        /// Creates serialization metadata for types assignable to <see cref="IList"/>.
 431        /// </summary>
 432        /// <typeparam name="TCollection">The generic definition of the type.</typeparam>
 433        /// <param name="options"></param>
 434        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 435        /// <returns>Serialization metadata for the given type.</returns>
 436        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 437        public static JsonTypeInfo<TCollection> CreateIEnumerableInfo<TCollection>(
 438            JsonSerializerOptions options,
 439            JsonCollectionInfoValues<TCollection> collectionInfo)
 440            where TCollection : IEnumerable
 0441            => CreateCore(
 0442                options,
 0443                collectionInfo,
 0444                new IEnumerableConverter<TCollection>());
 445
 446        /// <summary>
 447        /// Creates serialization metadata for <see cref="Memory{T}"/>.
 448        /// </summary>
 449        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 450        /// <param name="options">The <see cref="JsonSerializerOptions"/> to use.</param>
 451        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 452        /// <returns>Serialization metadata for the given type.</returns>
 453        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 454        public static JsonTypeInfo<Memory<TElement>> CreateMemoryInfo<TElement>(JsonSerializerOptions options, JsonColle
 0455            => CreateCore(
 0456                options,
 0457                collectionInfo,
 0458                new MemoryConverter<TElement>());
 459
 460        /// <summary>
 461        /// Creates serialization metadata for <see cref="ReadOnlyMemory{T}"/>.
 462        /// </summary>
 463        /// <typeparam name="TElement">The generic definition of the element type.</typeparam>
 464        /// <param name="options">The <see cref="JsonSerializerOptions"/> to use.</param>
 465        /// <param name="collectionInfo">Provides serialization metadata about the collection type.</param>
 466        /// <returns>Serialization metadata for the given type.</returns>
 467        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 468        public static JsonTypeInfo<ReadOnlyMemory<TElement>> CreateReadOnlyMemoryInfo<TElement>(JsonSerializerOptions op
 0469            => CreateCore(
 0470                options,
 0471                collectionInfo,
 0472                new ReadOnlyMemoryConverter<TElement>());
 473    }
 474}
 475

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.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.Text.Json.Nodes;
 5using System.Text.Json.Serialization.Converters;
 6
 7namespace System.Text.Json.Serialization.Metadata
 8{
 9    public static partial class JsonMetadataServices
 10    {
 11        // When adding/removing a built-in JsonConverter property below, also update
 12        // gen/JsonSourceGenerator.Parser.cs::GetSupportedJsonValueTypes so the union ambiguity
 13        // diagnostic (SYSLIB1227) agrees with JsonTypeInfo.BuildUnionValueTypeMap.
 14
 15        /// <summary>
 16        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="bool"/> values.
 17        /// </summary>
 18        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 119        public static JsonConverter<bool> BooleanConverter => field ??= new BooleanConverter();
 20
 21        /// <summary>
 22        /// Returns a <see cref="JsonConverter{T}"/> instance that converts byte array values.
 23        /// </summary>
 24        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 125        public static JsonConverter<byte[]?> ByteArrayConverter => field ??= new ByteArrayConverter();
 26
 27        /// <summary>
 28        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="byte"/> values.
 29        /// </summary>
 30        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 131        public static JsonConverter<byte> ByteConverter => field ??= new ByteConverter();
 32
 33        /// <summary>
 34        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="char"/> values.
 35        /// </summary>
 36        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 137        public static JsonConverter<char> CharConverter => field ??= new CharConverter();
 38
 39        /// <summary>
 40        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="DateTime"/> values.
 41        /// </summary>
 42        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 143        public static JsonConverter<DateTime> DateTimeConverter => field ??= new DateTimeConverter();
 44
 45        /// <summary>
 46        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="DateTimeOffset"/> values.
 47        /// </summary>
 48        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 149        public static JsonConverter<DateTimeOffset> DateTimeOffsetConverter => field ??= new DateTimeOffsetConverter();
 50
 51#if NET
 52        /// <summary>
 53        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="DateOnly"/> values.
 54        /// </summary>
 55        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 156        public static JsonConverter<DateOnly> DateOnlyConverter => field ??= new DateOnlyConverter();
 57
 58        /// <summary>
 59        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="TimeOnly"/> values.
 60        /// </summary>
 61        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 162        public static JsonConverter<TimeOnly> TimeOnlyConverter => field ??= new TimeOnlyConverter();
 63#endif
 64
 65        /// <summary>
 66        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="decimal"/> values.
 67        /// </summary>
 68        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 169        public static JsonConverter<decimal> DecimalConverter => field ??= new DecimalConverter();
 70
 71        /// <summary>
 72        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="double"/> values.
 73        /// </summary>
 74        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 175        public static JsonConverter<double> DoubleConverter => field ??= new DoubleConverter();
 76
 77        /// <summary>
 78        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Guid"/> values.
 79        /// </summary>
 80        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 181        public static JsonConverter<Guid> GuidConverter => field ??= new GuidConverter();
 82
 83        /// <summary>
 84        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="short"/> values.
 85        /// </summary>
 86        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 187        public static JsonConverter<short> Int16Converter => field ??= new Int16Converter();
 88
 89        /// <summary>
 90        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="int"/> values.
 91        /// </summary>
 92        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 193        public static JsonConverter<int> Int32Converter => field ??= new Int32Converter();
 94
 95        /// <summary>
 96        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="long"/> values.
 97        /// </summary>
 98        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 199        public static JsonConverter<long> Int64Converter => field ??= new Int64Converter();
 100
 101#if NET
 102        /// <summary>
 103        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Int128"/> values.
 104        /// </summary>
 105        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1106        public static JsonConverter<Int128> Int128Converter => field ??= new Int128Converter();
 107
 108        /// <summary>
 109        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="UInt128"/> values.
 110        /// </summary>
 111        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 112        [CLSCompliant(false)]
 1113        public static JsonConverter<UInt128> UInt128Converter => field ??= new UInt128Converter();
 114#endif
 115
 116        /// <summary>
 117        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonArray"/> values.
 118        /// </summary>
 119        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 0120        public static JsonConverter<JsonArray?> JsonArrayConverter => field ??= new JsonArrayConverter();
 121
 122        /// <summary>
 123        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonElement"/> values.
 124        /// </summary>
 125        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1126        public static JsonConverter<JsonElement> JsonElementConverter => field ??= new JsonElementConverter();
 127
 128        /// <summary>
 129        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonNode"/> values.
 130        /// </summary>
 131        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 0132        public static JsonConverter<JsonNode?> JsonNodeConverter => field ??= new JsonNodeConverter();
 133
 134        /// <summary>
 135        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonObject"/> values.
 136        /// </summary>
 137        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 0138        public static JsonConverter<JsonObject?> JsonObjectConverter => field ??= new JsonObjectConverter();
 139
 140        /// <summary>
 141        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonArray"/> values.
 142        /// </summary>
 143        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 0144        public static JsonConverter<JsonValue?> JsonValueConverter => field ??= new JsonValueConverter();
 145
 146        /// <summary>
 147        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="JsonDocument"/> values.
 148        /// </summary>
 149        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1150        public static JsonConverter<JsonDocument?> JsonDocumentConverter => field ??= new JsonDocumentConverter();
 151
 152        /// <summary>
 153        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Memory{Byte}"/> values.
 154        /// </summary>
 155        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1156        public static JsonConverter<Memory<byte>> MemoryByteConverter => field ??= new MemoryByteConverter();
 157
 158        /// <summary>
 159        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="ReadOnlyMemory{Byte}"/> values.
 160        /// </summary>
 161        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1162        public static JsonConverter<ReadOnlyMemory<byte>> ReadOnlyMemoryByteConverter => field ??= new ReadOnlyMemoryByt
 163
 164        /// <summary>
 165        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="object"/> values.
 166        /// </summary>
 167        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1168        public static JsonConverter<object?> ObjectConverter => field ??= new DefaultObjectConverter();
 169
 170#if NET
 171        /// <summary>
 172        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Half"/> values.
 173        /// </summary>
 174        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1175        public static JsonConverter<Half> HalfConverter => field ??= new HalfConverter();
 176#endif
 177
 178#if NET11_0_OR_GREATER
 179        /// <summary>
 180        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="System.Numerics.BFloat16"/> value
 181        /// </summary>
 182        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 183        public static JsonConverter<System.Numerics.BFloat16> BFloat16Converter =>
 1184            field ??= new Ieee754FloatingPointConverter<System.Numerics.BFloat16>(NumericType.BFloat16);
 185
 186        /// <summary>
 187        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="System.Numerics.Decimal32"/> valu
 188        /// </summary>
 189        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 190        public static JsonConverter<System.Numerics.Decimal32> Decimal32Converter =>
 1191            field ??= new Ieee754FloatingPointConverter<System.Numerics.Decimal32>(NumericType.Decimal32);
 192
 193        /// <summary>
 194        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="System.Numerics.Decimal64"/> valu
 195        /// </summary>
 196        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 197        public static JsonConverter<System.Numerics.Decimal64> Decimal64Converter =>
 1198            field ??= new Ieee754FloatingPointConverter<System.Numerics.Decimal64>(NumericType.Decimal64);
 199
 200        /// <summary>
 201        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="System.Numerics.Decimal128"/> val
 202        /// </summary>
 203        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 204        public static JsonConverter<System.Numerics.Decimal128> Decimal128Converter =>
 1205            field ??= new Ieee754FloatingPointConverter<System.Numerics.Decimal128>(NumericType.Decimal128);
 206#endif
 207
 208        /// <summary>
 209        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="float"/> values.
 210        /// </summary>
 211        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1212        public static JsonConverter<float> SingleConverter => field ??= new SingleConverter();
 213
 214        /// <summary>
 215        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="sbyte"/> values.
 216        /// </summary>
 217        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 218        [CLSCompliant(false)]
 1219        public static JsonConverter<sbyte> SByteConverter => field ??= new SByteConverter();
 220
 221        /// <summary>
 222        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="string"/> values.
 223        /// </summary>
 224        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1225        public static JsonConverter<string?> StringConverter => field ??= new StringConverter();
 226
 227        /// <summary>
 228        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="TimeSpan"/> values.
 229        /// </summary>
 230        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1231        public static JsonConverter<TimeSpan> TimeSpanConverter => field ??= new TimeSpanConverter();
 232
 233        /// <summary>
 234        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="ushort"/> values.
 235        /// </summary>
 236        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 237        [CLSCompliant(false)]
 1238        public static JsonConverter<ushort> UInt16Converter => field ??= new UInt16Converter();
 239
 240        /// <summary>
 241        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="uint"/> values.
 242        /// </summary>
 243        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 244        [CLSCompliant(false)]
 1245        public static JsonConverter<uint> UInt32Converter => field ??= new UInt32Converter();
 246
 247        /// <summary>
 248        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="ulong"/> values.
 249        /// </summary>
 250        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 251        [CLSCompliant(false)]
 1252        public static JsonConverter<ulong> UInt64Converter => field ??= new UInt64Converter();
 253
 254        /// <summary>
 255        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Uri"/> values.
 256        /// </summary>
 257        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1258        public static JsonConverter<Uri?> UriConverter => field ??= new UriConverter();
 259
 260        /// <summary>
 261        /// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Version"/> values.
 262        /// </summary>
 263        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 1264        public static JsonConverter<Version?> VersionConverter => field ??= new VersionConverter();
 265
 266        /// <summary>
 267        /// Creates a <see cref="JsonConverter{T}"/> instance that throws <see cref="NotSupportedException"/>.
 268        /// </summary>
 269        /// <typeparam name="T">The generic definition for the type.</typeparam>
 270        /// <returns>A <see cref="JsonConverter{T}"/> instance that throws <see cref="NotSupportedException"/></returns>
 271        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 272        public static JsonConverter<T> GetUnsupportedTypeConverter<T>()
 0273            => new UnsupportedTypeConverter<T>();
 274
 275        /// <summary>
 276        /// Creates a <see cref="JsonConverter{T}"/> instance that converts <typeparamref name="T"/> values.
 277        /// </summary>
 278        /// <typeparam name="T">The generic definition for the enum type.</typeparam>
 279        /// <param name="options">The <see cref="JsonSerializerOptions"/> to use for serialization and deserialization.<
 280        /// <returns>A <see cref="JsonConverter{T}"/> instance that converts <typeparamref name="T"/> values.</returns>
 281        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 282        public static JsonConverter<T> GetEnumConverter<T>(JsonSerializerOptions options) where T : struct, Enum
 0283        {
 0284            ArgumentNullException.ThrowIfNull(options);
 285
 0286            return EnumConverterFactory.Helpers.Create<T>(EnumConverterOptions.AllowNumbers, options);
 0287        }
 288
 289        /// <summary>
 290        /// Creates a <see cref="JsonConverter{T}"/> instance that converts <typeparamref name="T?"/> values.
 291        /// </summary>
 292        /// <typeparam name="T">The generic definition for the underlying nullable type.</typeparam>
 293        /// <param name="underlyingTypeInfo">Serialization metadata for the underlying nullable type.</param>
 294        /// <returns>A <see cref="JsonConverter{T}"/> instance that converts <typeparamref name="T?"/> values</returns>
 295        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 296        public static JsonConverter<T?> GetNullableConverter<T>(JsonTypeInfo<T> underlyingTypeInfo) where T : struct
 0297        {
 0298            ArgumentNullException.ThrowIfNull(underlyingTypeInfo);
 299
 0300            JsonConverter<T> underlyingConverter = GetTypedConverter<T>(underlyingTypeInfo.Converter);
 301
 0302            return new NullableConverter<T>(underlyingConverter);
 0303        }
 304
 305        /// <summary>
 306        /// Creates a <see cref="JsonConverter{T}"/> instance that converts <typeparamref name="T?"/> values.
 307        /// </summary>
 308        /// <typeparam name="T">The generic definition for the underlying nullable type.</typeparam>
 309        /// <param name="options">The <see cref="JsonSerializerOptions"/> to use for serialization and deserialization.<
 310        /// <returns>A <see cref="JsonConverter{T}"/> instance that converts <typeparamref name="T?"/> values</returns>
 311        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 312        public static JsonConverter<T?> GetNullableConverter<T>(JsonSerializerOptions options) where T : struct
 0313        {
 0314            ArgumentNullException.ThrowIfNull(options);
 315
 0316            JsonConverter<T> underlyingConverter = GetTypedConverter<T>(options.GetConverterInternal(typeof(T)));
 317
 0318            return new NullableConverter<T>(underlyingConverter);
 0319        }
 320
 321        internal static JsonConverter<T> GetTypedConverter<T>(JsonConverter converter)
 0322        {
 0323            JsonConverter<T>? typedConverter = converter as JsonConverter<T>;
 0324            if (typedConverter is null)
 0325            {
 0326                throw new InvalidOperationException(SR.Format(SR.SerializationConverterNotCompatible, typedConverter, ty
 327            }
 328
 0329            return typedConverter;
 0330        }
 331    }
 332}
 333

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.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.ComponentModel;
 5using System.Text.Json.Serialization.Converters;
 6
 7namespace System.Text.Json.Serialization.Metadata
 8{
 9    /// <summary>
 10    /// Provides helpers to create and initialize metadata for JSON-serializable types.
 11    /// </summary>
 12    /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called dir
 13    [EditorBrowsable(EditorBrowsableState.Never)]
 14    public static partial class JsonMetadataServices
 15    {
 16        /// <summary>
 17        /// Creates metadata for a property or field.
 18        /// </summary>
 19        /// <typeparam name="T">The type that the converter for the property returns or accepts when converting JSON dat
 20        /// <param name="options">The <see cref="JsonSerializerOptions"/> to initialize the metadata with.</param>
 21        /// <param name="propertyInfo">Provides serialization metadata about the property or field.</param>
 22        /// <returns>A <see cref="JsonPropertyInfo"/> instance initialized with the provided metadata.</returns>
 23        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 24        public static JsonPropertyInfo CreatePropertyInfo<T>(JsonSerializerOptions options, JsonPropertyInfoValues<T> pr
 025        {
 026            ArgumentNullException.ThrowIfNull(options);
 027            ArgumentNullException.ThrowIfNull(propertyInfo);
 28
 029            Type? declaringType = propertyInfo.DeclaringType;
 030            if (declaringType == null)
 031            {
 032                throw new ArgumentException(nameof(propertyInfo.DeclaringType));
 33            }
 34
 035            string? propertyName = propertyInfo.PropertyName;
 036            if (propertyName is null)
 037            {
 038                throw new ArgumentException(nameof(propertyInfo.PropertyName));
 39            }
 40
 041            if (!propertyInfo.IsProperty && propertyInfo.IsVirtual)
 042            {
 043                throw new InvalidOperationException(SR.Format(SR.FieldCannotBeVirtual, nameof(propertyInfo.IsProperty), 
 44            }
 45
 046            return CreatePropertyInfoCore(propertyInfo, options);
 047        }
 48
 49        /// <summary>
 50        /// Creates metadata for a complex class or struct.
 51        /// </summary>
 52        /// <param name="options">The <see cref="JsonSerializerOptions"/> to initialize the metadata with.</param>
 53        /// <param name="objectInfo">Provides serialization metadata about an object type with constructors, properties,
 54        /// <typeparam name="T">The type of the class or struct.</typeparam>
 55        /// <exception cref="ArgumentNullException">Thrown when <paramref name="options"/> or <paramref name="objectInfo
 56        /// <returns>A <see cref="JsonTypeInfo{T}"/> instance representing the class or struct.</returns>
 57        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 58        public static JsonTypeInfo<T> CreateObjectInfo<T>(JsonSerializerOptions options, JsonObjectInfoValues<T> objectI
 059        {
 060            ArgumentNullException.ThrowIfNull(options);
 061            ArgumentNullException.ThrowIfNull(objectInfo);
 62
 063            return CreateCore(options, objectInfo);
 064        }
 65
 66        /// <summary>
 67        /// Creates metadata for a union type.
 68        /// </summary>
 69        /// <param name="options">The <see cref="JsonSerializerOptions"/> to initialize the metadata with.</param>
 70        /// <param name="unionInfo">Provides serialization metadata about a union type and its cases.</param>
 71        /// <typeparam name="T">The type of the union.</typeparam>
 72        /// <exception cref="ArgumentNullException">Thrown when <paramref name="options"/> or <paramref name="unionInfo"
 73        /// <returns>A <see cref="JsonTypeInfo{T}"/> instance representing the union type.</returns>
 74        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 75        public static JsonTypeInfo<T> CreateUnionInfo<T>(JsonSerializerOptions options, JsonUnionInfoValues<T> unionInfo
 076        {
 077            ArgumentNullException.ThrowIfNull(options);
 078            ArgumentNullException.ThrowIfNull(unionInfo);
 079            ArgumentNullException.ThrowIfNull(unionInfo.UnionCases);
 80
 081            JsonConverter<T> converter = new JsonUnionConverter<T>();
 082            var typeInfo = new JsonTypeInfo<T>(converter, options)
 083            {
 084                UnionConstructor = unionInfo.UnionConstructor,
 085                UnionDeconstructor = unionInfo.UnionDeconstructor,
 086                TypeClassifier = unionInfo.TypeClassifier,
 087            };
 88
 089            foreach (JsonUnionCaseInfo caseInfo in unionInfo.UnionCases)
 090            {
 091                typeInfo.UnionCases.Add(caseInfo);
 092            }
 93
 094            typeInfo.TypeClassifierFactory = unionInfo.TypeClassifierFactory;
 095            typeInfo.TypeClassifierResolutionPending = true;
 96
 097            typeInfo.IsCustomized = false;
 098            return typeInfo;
 099        }
 100
 101        /// <summary>
 102        /// Creates metadata for a primitive or a type with a custom converter.
 103        /// </summary>
 104        /// <typeparam name="T">The generic type definition.</typeparam>
 105        /// <returns>A <see cref="JsonTypeInfo{T}"/> instance representing the type.</returns>
 106        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called
 107        public static JsonTypeInfo<T> CreateValueInfo<T>(JsonSerializerOptions options, JsonConverter converter)
 0108        {
 0109            ArgumentNullException.ThrowIfNull(options);
 0110            ArgumentNullException.ThrowIfNull(converter);
 111
 0112            JsonTypeInfo<T> info = CreateCore<T>(converter, options);
 0113            return info;
 0114        }
 115    }
 116}
 117

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.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.Diagnostics;
 5using System.Reflection;
 6using System.Text.Json.Serialization.Converters;
 7
 8namespace System.Text.Json.Serialization.Metadata
 9{
 10    public static partial class JsonMetadataServices
 11    {
 12        /// <summary>
 13        /// Creates serialization metadata for a type using a simple converter.
 14        /// </summary>
 15        private static JsonTypeInfo<T> CreateCore<T>(JsonConverter converter, JsonSerializerOptions options)
 016        {
 017            var typeInfo = new JsonTypeInfo<T>(converter, options);
 018            PopulatePolymorphismMetadata(typeInfo, polymorphismOptions: null, typeClassifierFactory: null);
 019            typeInfo.MapInterfaceTypesToCallbacks();
 20
 21            // Plug in any converter configuration -- should be run last.
 022            converter.ConfigureJsonTypeInfo(typeInfo, options);
 023            typeInfo.IsCustomized = false;
 024            return typeInfo;
 025        }
 26
 27        /// <summary>
 28        /// Creates serialization metadata for an object.
 29        /// </summary>
 30        private static JsonTypeInfo<T> CreateCore<T>(JsonSerializerOptions options, JsonObjectInfoValues<T> objectInfo)
 031        {
 032            JsonConverter<T> converter = GetConverter(objectInfo);
 033            var typeInfo = new JsonTypeInfo<T>(converter, options);
 034            if (objectInfo.ObjectWithParameterizedConstructorCreator is not null)
 035            {
 36                // NB parameter metadata must be populated *before* property metadata
 37                // so that properties can be linked to their associated parameters.
 038                typeInfo.CreateObjectWithArgs = objectInfo.ObjectWithParameterizedConstructorCreator;
 039                PopulateParameterInfoValues(typeInfo, objectInfo.ConstructorParameterMetadataInitializer);
 040            }
 41            else
 042            {
 043                typeInfo.SetCreateObjectIfCompatible(objectInfo.ObjectCreator);
 044                typeInfo.CreateObjectForExtensionDataProperty = ((JsonTypeInfo)typeInfo).CreateObject;
 045            }
 46
 047            if (objectInfo.PropertyMetadataInitializer is not null)
 048            {
 049                typeInfo.SourceGenDelayedPropertyInitializer = objectInfo.PropertyMetadataInitializer;
 050            }
 51            else
 052            {
 053                typeInfo.PropertyMetadataSerializationNotSupported = true;
 054            }
 55
 056            typeInfo.ConstructorAttributeProviderFactory = objectInfo.ConstructorAttributeProviderFactory;
 057            typeInfo.SerializeHandler = objectInfo.SerializeHandler;
 058            typeInfo.NumberHandling = objectInfo.NumberHandling;
 59
 060            PopulatePolymorphismMetadata(typeInfo, objectInfo.PolymorphismOptions, objectInfo.TypeClassifierFactory);
 61
 062            typeInfo.MapInterfaceTypesToCallbacks();
 63
 64            // Plug in any converter configuration -- should be run last.
 065            converter.ConfigureJsonTypeInfo(typeInfo, options);
 066            typeInfo.IsCustomized = false;
 067            return typeInfo;
 068        }
 69
 70        /// <summary>
 71        /// Creates serialization metadata for a collection.
 72        /// </summary>
 73        private static JsonTypeInfo<T> CreateCore<T>(
 74            JsonSerializerOptions options,
 75            JsonCollectionInfoValues<T> collectionInfo,
 76            JsonConverter<T> converter,
 77            object? createObjectWithArgs = null,
 78            object? addFunc = null)
 079        {
 080            ArgumentNullException.ThrowIfNull(collectionInfo);
 81
 082            converter = collectionInfo.SerializeHandler is not null
 083                ? new JsonMetadataServicesConverter<T>(converter)
 084                : converter;
 85
 086            JsonTypeInfo<T> typeInfo = new JsonTypeInfo<T>(converter, options);
 87
 088            typeInfo.KeyTypeInfo = collectionInfo.KeyInfo;
 089            typeInfo.ElementTypeInfo = collectionInfo.ElementInfo;
 090            Debug.Assert(typeInfo.Kind != JsonTypeInfoKind.None);
 091            typeInfo.NumberHandling = collectionInfo.NumberHandling;
 092            typeInfo.SerializeHandler = collectionInfo.SerializeHandler;
 093            typeInfo.CreateObjectWithArgs = createObjectWithArgs;
 094            typeInfo.AddMethodDelegate = addFunc;
 095            typeInfo.SetCreateObjectIfCompatible(collectionInfo.ObjectCreator);
 096            PopulatePolymorphismMetadata(typeInfo, collectionInfo.PolymorphismOptions, collectionInfo.TypeClassifierFact
 97
 098            typeInfo.MapInterfaceTypesToCallbacks();
 99
 100            // Plug in any converter configuration -- should be run last.
 0101            converter.ConfigureJsonTypeInfo(typeInfo, options);
 0102            typeInfo.IsCustomized = false;
 0103            return typeInfo;
 0104        }
 105
 106        private static JsonConverter<T> GetConverter<T>(JsonObjectInfoValues<T> objectInfo)
 0107        {
 108#pragma warning disable CS8714 // Nullability of type argument 'T' doesn't match 'notnull' constraint.
 0109            JsonConverter<T> converter = objectInfo.ObjectWithParameterizedConstructorCreator is not null
 0110                ? new LargeObjectWithParameterizedConstructorConverter<T>()
 0111                : new ObjectDefaultConverter<T>();
 112#pragma warning restore CS8714
 113
 0114            return objectInfo.SerializeHandler is not null
 0115                ? new JsonMetadataServicesConverter<T>(converter)
 0116                : converter;
 0117        }
 118
 119        private static void PopulatePolymorphismMetadata(
 120            JsonTypeInfo typeInfo,
 121            JsonPolymorphismOptions? polymorphismOptions,
 122            JsonTypeClassifierFactory? typeClassifierFactory)
 0123        {
 0124            if (polymorphismOptions is null)
 0125            {
 126                // Older versions of the source generator do not populate polymorphism options,
 127                // so attempt to populate it from attributes at runtime.
 0128                polymorphismOptions = JsonPolymorphismOptions.CreateFromAttributeDeclarations(typeInfo.Type, out _);
 0129                typeClassifierFactory = null;
 0130            }
 0131            else if (polymorphismOptions.IsEmpty)
 0132            {
 133                // An empty options instance indicates no polymorphism metadata was provided at compile time.
 0134                polymorphismOptions = null;
 0135                typeClassifierFactory = null;
 0136            }
 137
 0138            if (polymorphismOptions is not null)
 0139            {
 0140                typeInfo.SetPolymorphismOptions(polymorphismOptions);
 0141                if (typeClassifierFactory is not null || typeInfo.Options.TypeClassifiers.Count > 0)
 0142                {
 0143                    typeInfo.TypeClassifierFactory = typeClassifierFactory;
 0144                    typeInfo.TypeClassifierResolutionPending = true;
 0145                }
 0146            }
 0147        }
 148
 149        private static void PopulateParameterInfoValues(JsonTypeInfo typeInfo, Func<JsonParameterInfoValues[]?>? paramFa
 0150        {
 0151            Debug.Assert(typeInfo.Kind is JsonTypeInfoKind.Object);
 0152            Debug.Assert(!typeInfo.IsReadOnly);
 153
 0154            if (paramFactory?.Invoke() is JsonParameterInfoValues[] parameterInfoValues)
 0155            {
 0156                typeInfo.PopulateParameterInfoValues(parameterInfoValues);
 0157            }
 158            else
 0159            {
 0160                typeInfo.PropertyMetadataSerializationNotSupported = true;
 0161            }
 0162        }
 163
 164        internal static void PopulateProperties(JsonTypeInfo typeInfo, JsonTypeInfo.JsonPropertyInfoList propertyList, F
 0165        {
 0166            Debug.Assert(typeInfo.Kind is JsonTypeInfoKind.Object);
 0167            Debug.Assert(!typeInfo.IsConfigured);
 0168            Debug.Assert(typeInfo.Type != typeof(object));
 0169            Debug.Assert(typeInfo.Converter.ElementType is null);
 170
 0171            JsonSerializerContext? context = typeInfo.Options.TypeInfoResolver as JsonSerializerContext;
 0172            JsonPropertyInfo[] properties = propInitFunc(context!);
 173
 174            // Regardless of the source generator we need to re-run the naming conflict resolution algorithm
 175            // at run time since it is possible that the naming policy or other configs can be different then.
 0176            JsonTypeInfo.PropertyHierarchyResolutionState state = new(typeInfo.Options);
 177
 0178            foreach (JsonPropertyInfo jsonPropertyInfo in properties)
 0179            {
 0180                if (!jsonPropertyInfo.SrcGen_IsPublic)
 0181                {
 0182                    if (jsonPropertyInfo.SrcGen_HasJsonInclude)
 0183                    {
 0184                        if (jsonPropertyInfo.Get is null && jsonPropertyInfo.Set is null)
 0185                        {
 186                            // [JsonInclude] property is inaccessible and the source generator
 187                            // did not provide getter/setter delegates (e.g. older generator).
 0188                            Debug.Assert(jsonPropertyInfo.MemberName is not null, "MemberName is not set by source gen")
 0189                            ThrowHelper.ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(jsonPropertyInf
 190                        }
 191
 192                        // Non-public [JsonInclude] property with getter/setter delegates provided
 193                        // via UnsafeAccessor or reflection fallback — treat it as a valid property.
 0194                    }
 195                    else
 0196                    {
 0197                        continue;
 198                    }
 0199                }
 200
 0201                if (jsonPropertyInfo.MemberType == MemberTypes.Field && !jsonPropertyInfo.SrcGen_HasJsonInclude && !type
 0202                {
 0203                    continue;
 204                }
 205
 0206                propertyList.AddPropertyWithConflictResolution(jsonPropertyInfo, ref state);
 0207            }
 208
 0209            if (state.IsPropertyOrderSpecified)
 0210            {
 0211                propertyList.SortProperties();
 0212            }
 0213        }
 214
 215        private static JsonPropertyInfo<T> CreatePropertyInfoCore<T>(JsonPropertyInfoValues<T> propertyInfoValues, JsonS
 0216        {
 0217            var propertyInfo = new JsonPropertyInfo<T>(propertyInfoValues.DeclaringType, declaringTypeInfo: null, option
 218
 0219            DeterminePropertyName(propertyInfo,
 0220                declaredPropertyName: propertyInfoValues.PropertyName,
 0221                declaredJsonPropertyName: propertyInfoValues.JsonPropertyName);
 222
 0223            propertyInfo.MemberName = propertyInfoValues.PropertyName;
 0224            propertyInfo.MemberType = propertyInfoValues.IsProperty ? MemberTypes.Property : MemberTypes.Field;
 0225            propertyInfo.SrcGen_IsPublic = propertyInfoValues.IsPublic;
 0226            propertyInfo.SrcGen_HasJsonInclude = propertyInfoValues.HasJsonInclude;
 0227            propertyInfo.IsExtensionData = propertyInfoValues.IsExtensionData;
 0228            propertyInfo.CustomConverter = propertyInfoValues.Converter;
 229
 0230            if (propertyInfo.IgnoreCondition != JsonIgnoreCondition.Always)
 0231            {
 0232                propertyInfo.Get = propertyInfoValues.Getter!;
 0233                propertyInfo.Set = propertyInfoValues.Setter;
 0234            }
 235
 0236            propertyInfo.IgnoreCondition = propertyInfoValues.IgnoreCondition;
 0237            propertyInfo.JsonTypeInfo = propertyInfoValues.PropertyTypeInfo;
 0238            propertyInfo.NumberHandling = propertyInfoValues.NumberHandling;
 0239            propertyInfo.AttributeProviderFactory = propertyInfoValues.AttributeProviderFactory;
 240
 0241            return propertyInfo;
 0242        }
 243
 244        private static void DeterminePropertyName(
 245            JsonPropertyInfo propertyInfo,
 246            string declaredPropertyName,
 247            string? declaredJsonPropertyName)
 0248        {
 249            string? name;
 250
 251            // Property name settings.
 0252            if (declaredJsonPropertyName is not null)
 0253            {
 0254                name = declaredJsonPropertyName;
 0255            }
 0256            else if (propertyInfo.Options.PropertyNamingPolicy is null)
 0257            {
 0258                name = declaredPropertyName;
 0259            }
 260            else
 0261            {
 0262                name = propertyInfo.Options.PropertyNamingPolicy.ConvertName(declaredPropertyName);
 0263            }
 264
 265            // Compat: We need to do validation before we assign Name so that we get InvalidOperationException rather th
 0266            if (name is null)
 0267            {
 0268                ThrowHelper.ThrowInvalidOperationException_SerializerPropertyNameNull(propertyInfo);
 269            }
 270
 0271            propertyInfo.Name = name;
 0272        }
 273    }
 274}
 275

Methods/Properties

CreateArrayInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TElement[]>)
CreateListInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateDictionaryInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateImmutableDictionaryInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>,System.Func`2<System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<TKey,TValue>>,TCollection>)
CreateIDictionaryInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateIReadOnlyDictionaryInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateImmutableEnumerableInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>,System.Func`2<System.Collections.Generic.IEnumerable`1<TElement>,TCollection>)
CreateIListInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateISetInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateIReadOnlySetInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateICollectionInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateStackInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateQueueInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateConcurrentStackInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateConcurrentQueueInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateIEnumerableInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateIAsyncEnumerableInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>)
CreateStackInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>,System.Action`2<TCollection,System.Object>)
CreateQueueInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>,System.Action`2<TCollection,System.Object>)
CreateStackOrQueueInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<TCollection>,System.Action`2<TCollection,System.Object>)
CreateMemoryInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<System.Memory`1<TElement>>)
CreateReadOnlyMemoryInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<System.ReadOnlyMemory`1<TElement>>)
BooleanConverter()
ByteArrayConverter()
ByteConverter()
CharConverter()
DateTimeConverter()
DateTimeOffsetConverter()
DateOnlyConverter()
TimeOnlyConverter()
DecimalConverter()
DoubleConverter()
GuidConverter()
Int16Converter()
Int32Converter()
Int64Converter()
Int128Converter()
UInt128Converter()
JsonArrayConverter()
JsonElementConverter()
JsonNodeConverter()
JsonObjectConverter()
JsonValueConverter()
JsonDocumentConverter()
MemoryByteConverter()
ReadOnlyMemoryByteConverter()
ObjectConverter()
HalfConverter()
BFloat16Converter()
Decimal32Converter()
Decimal64Converter()
Decimal128Converter()
SingleConverter()
SByteConverter()
StringConverter()
TimeSpanConverter()
UInt16Converter()
UInt32Converter()
UInt64Converter()
UriConverter()
VersionConverter()
GetUnsupportedTypeConverter()
GetEnumConverter(System.Text.Json.JsonSerializerOptions)
GetNullableConverter(System.Text.Json.Serialization.Metadata.JsonTypeInfo`1<T>)
GetNullableConverter(System.Text.Json.JsonSerializerOptions)
GetTypedConverter(System.Text.Json.Serialization.JsonConverter)
CreatePropertyInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues`1<T>)
CreateObjectInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonObjectInfoValues`1<T>)
CreateUnionInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonUnionInfoValues`1<T>)
CreateValueInfo(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.JsonConverter)
CreateCore(System.Text.Json.Serialization.JsonConverter,System.Text.Json.JsonSerializerOptions)
CreateCore(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonObjectInfoValues`1<T>)
CreateCore(System.Text.Json.JsonSerializerOptions,System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1<T>,System.Text.Json.Serialization.JsonConverter`1<T>,System.Object,System.Object)
GetConverter(System.Text.Json.Serialization.Metadata.JsonObjectInfoValues`1<T>)
PopulatePolymorphismMetadata(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions,System.Text.Json.Serialization.JsonTypeClassifierFactory)
PopulateParameterInfoValues(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Func`1<System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]>)
PopulateProperties(System.Text.Json.Serialization.Metadata.JsonTypeInfo,System.Text.Json.Serialization.Metadata.JsonTypeInfo/JsonPropertyInfoList,System.Func`2<System.Text.Json.Serialization.JsonSerializerContext,System.Text.Json.Serialization.Metadata.JsonPropertyInfo[]>)
CreatePropertyInfoCore(System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues`1<T>,System.Text.Json.JsonSerializerOptions)
DeterminePropertyName(System.Text.Json.Serialization.Metadata.JsonPropertyInfo,System.String,System.String)