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

icerpc / icerpc-csharp / 20870171951

10 Jan 2026 01:03AM UTC coverage: 83.304% (-0.1%) from 83.399%
20870171951

Pull #4221

github

web-flow
Merge fe4f556d8 into f39e9819d
Pull Request #4221: Use new C#14 extension block syntax

12030 of 14441 relevant lines covered (83.3%)

2957.05 hits per line

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

53.85
src/IceRpc/TypeExtensions.cs
1
// Copyright (c) ZeroC, Inc.
2

3
// TODO: temporary, for paramref. See #4220.
4
#pragma warning disable CS1734 // XML comment has a type parameter reference that is not valid.
5

6
namespace IceRpc;
7

8
/// <summary>Provides extension methods for <see cref="Type" />.</summary>
9
public static class TypeExtensions
10
{
11
    /// <summary>Extension methods for <see cref="Type" />.</summary>
12
    /// <param name="type">The type of an interface.</param>
13
    extension(Type type)
14
    {
15
        /// <summary>Retrieves the default service path with the attribute <see cref="DefaultServicePathAttribute"/>.
16
        /// </summary>
17
        /// <returns>The default service path.</returns>
18
        /// <exception cref="ArgumentException">Thrown if <paramref name="type" /> is not an interface, or if
19
        /// it does not have a <see cref="DefaultServicePathAttribute" /> attribute.</exception>
20
        public string GetDefaultServicePath()
21
        {
7✔
22
            if (type.IsInterface)
7✔
23
            {
7✔
24
                object[] attributes = type.GetCustomAttributes(typeof(DefaultServicePathAttribute), false);
7✔
25
                if (attributes.Length == 1 && attributes[0] is DefaultServicePathAttribute defaultServicePath)
7✔
26
                {
7✔
27
                    return defaultServicePath.Value;
7✔
28
                }
29
                else
30
                {
×
31
                    throw new ArgumentException(
×
32
                        $"Interface '{type}' does not have a {nameof(DefaultServicePathAttribute)} attribute.",
×
33
                        nameof(type));
×
34
                }
35
            }
36
            else
37
            {
×
38
                throw new ArgumentException($"The type '{type}' is not an interface.", nameof(type));
×
39
            }
40
        }
41
    }
42
}
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