• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

net-daemon / netdaemon / 14943270830

10 May 2025 07:36AM UTC coverage: 84.091% (-0.2%) from 84.281%
14943270830

Pull #1309

github

web-flow
Merge 66e08c0d3 into dc4945834
Pull Request #1309: Fix crash in 2025.5

859 of 1145 branches covered (75.02%)

Branch coverage included in aggregate %.

12 of 23 new or added lines in 2 files covered. (52.17%)

1 existing line in 1 file now uncovered.

3359 of 3871 relevant lines covered (86.77%)

221.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/src/Client/NetDaemon.HassClient/Internal/Json/EnsureArrayOfArrayOfStringConverter.cs
1
namespace NetDaemon.Client.Internal.Json;
2

3
using System.Text.Json;
4
using System.Text.Json.Serialization;
5

6
/// <summary>
7
/// Converts a Json element that can be an array of arrays of strings to a list of lists of strings.
8
/// </summary>
9
class EnsureArrayOfArrayOfStringConverter : JsonConverter<IReadOnlyList<IReadOnlyList<string>>>
10
{
11
    private readonly EnsureStringConverter _ensureStringConverter = new();
5✔
12

13
    public override IReadOnlyList<IReadOnlyList<string>> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
14
    {
15
        if (reader.TokenType == JsonTokenType.StartArray)
17!
16
        {
17
            var list = new List<IReadOnlyList<string>>();
17✔
18
            while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
38✔
19
            {
20
                if (reader.TokenType == JsonTokenType.StartArray)
21✔
21
                {
22
                    var innerList = new List<string>();
21✔
23
                    while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
62✔
24
                    {
25
                        string? item = _ensureStringConverter.Read(ref reader, typeof(string), options);
41✔
26
                        if (item != null)
41✔
27
                        {
28
                            innerList.Add(item);
41✔
29
                        }
30
                    }
31
                    list.Add(innerList);
21✔
32
                }
33
            }
34
            return list;
17✔
35
        }
36

NEW
37
        reader.Skip();
×
NEW
38
        return [];
×
39
    }
40

41
    public override void Write(Utf8JsonWriter writer, IReadOnlyList<IReadOnlyList<string>> value, JsonSerializerOptions options)
42
    {
NEW
43
        writer.WriteStartArray();
×
NEW
44
        foreach (var innerList in value)
×
45
        {
NEW
46
            writer.WriteStartArray();
×
NEW
47
            foreach (var item in innerList)
×
48
            {
NEW
49
                writer.WriteStringValue(item);
×
50
            }
NEW
51
            writer.WriteEndArray();
×
52
        }
NEW
53
        writer.WriteEndArray();
×
NEW
54
    }
×
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc