< Summary

Information
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 29
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
ClearCache(...)0%220%

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\JsonSerializerOptionsUpdateHandler.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.Reflection.Metadata;
 6using System.Text.Json;
 7using System.Text.Json.Serialization.Metadata;
 8
 9[assembly: MetadataUpdateHandler(typeof(JsonSerializerOptionsUpdateHandler))]
 10
 11#pragma warning disable IDE0060
 12
 13namespace System.Text.Json
 14{
 15    /// <summary>Handler used to clear JsonSerializerOptions reflection cache upon a metadata update.</summary>
 16    internal static class JsonSerializerOptionsUpdateHandler
 17    {
 18        public static void ClearCache(Type[]? types)
 019        {
 20            // Ignore the types, and just clear out all reflection caches from serializer options.
 021            foreach (KeyValuePair<JsonSerializerOptions, object?> options in JsonSerializerOptions.TrackedOptionsInstanc
 022            {
 023                options.Key.ClearCaches();
 024            }
 25
 026            DefaultJsonTypeInfoResolver.ClearMemberAccessorCaches();
 027        }
 28    }
 29}

Methods/Properties

ClearCache(System.Type[])