< Summary

Information
Line coverage
14%
Covered lines: 2
Uncovered lines: 12
Coverable lines: 14
Total lines: 36
Line coverage: 14.2%
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
Read(...)100%1166.66%
Write(...)100%110%
ReadAsPropertyNameCore(...)100%110%
WriteAsPropertyNameCore(...)100%110%
GetSchema(...)100%110%

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Value\GuidConverter.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.Text.Json.Nodes;
 6using System.Text.Json.Schema;
 7
 8namespace System.Text.Json.Serialization.Converters
 9{
 10    internal sealed class GuidConverter : JsonPrimitiveConverter<Guid>
 11    {
 12        public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
 69013        {
 69014            return reader.GetGuid();
 015        }
 16
 17        public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)
 018        {
 019            writer.WriteStringValue(value);
 020        }
 21
 22        internal override Guid ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptio
 023        {
 024            Debug.Assert(reader.TokenType == JsonTokenType.PropertyName);
 025            return reader.GetGuidNoValidation();
 026        }
 27
 28        internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options,
 029        {
 030            writer.WritePropertyName(value);
 031        }
 32
 33        internal override JsonSchema? GetSchema(JsonNumberHandling numberHandling) =>
 034            new() { Type = JsonSchemaType.String, Format = "uuid" };
 35    }
 36}