< Summary

Information
Class: System.Text.Json.Serialization.JsonSerializableAttribute
Assembly: System.Text.Json
File(s): C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\Common\JsonSerializableAttribute.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 46
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\Common\JsonSerializableAttribute.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
 4#if !BUILDING_SOURCE_GENERATOR
 5using System.Text.Json.Serialization.Metadata;
 6#endif
 7
 8namespace System.Text.Json.Serialization
 9{
 10    /// <summary>
 11    /// Instructs the System.Text.Json source generator to generate source code to help optimize performance
 12    /// when serializing and deserializing instances of the specified type and types in its object graph.
 13    /// </summary>
 14    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
 15
 16#if BUILDING_SOURCE_GENERATOR
 17    internal
 18#else
 19    public
 20#endif
 21    sealed class JsonSerializableAttribute : JsonAttribute
 22    {
 23#pragma warning disable IDE0060
 24        /// <summary>
 25        /// Initializes a new instance of <see cref="JsonSerializableAttribute"/> with the specified type.
 26        /// </summary>
 27        /// <param name="type">The type to generate source code for.</param>
 028        public JsonSerializableAttribute(Type type) { }
 29#pragma warning restore IDE0060
 30
 31        /// <summary>
 32        /// The name of the property for the generated <see cref="JsonTypeInfo{T}"/> for
 33        /// the type on the generated, derived <see cref="JsonSerializerContext"/> type.
 34        /// </summary>
 35        /// <remarks>
 36        /// Useful to resolve a name collision with another type in the compilation closure.
 37        /// </remarks>
 038        public string? TypeInfoPropertyName { get; set; }
 39
 40        /// <summary>
 41        /// Determines what the source generator should generate for the type. If the value is <see cref="JsonSourceGene
 42        /// then the setting specified on <see cref="JsonSourceGenerationOptionsAttribute.GenerationMode"/> will be used
 43        /// </summary>
 044        public JsonSourceGenerationMode GenerationMode { get; set; }
 45    }
 46}