< Summary - Kestrun — Combined Coverage

Information
Class: KestrunAnnotationsRuntimeInfo
Assembly: Kestrun.Annotations
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun.Annotations/KestrunRuntimeInfo.cs
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
7%
Covered lines: 1
Uncovered lines: 12
Coverable lines: 13
Total lines: 52
Line coverage: 7.6%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 12/12/2025 - 17:27:19 Line coverage: 7.6% (1/13) Branch coverage: 0% (0/8) Total lines: 52 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd 12/12/2025 - 17:27:19 Line coverage: 7.6% (1/13) Branch coverage: 0% (0/8) Total lines: 52 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_IsReleaseDistribution()100%11100%
get_IsDebugBuild()100%210%
GetBuiltTargetFrameworkVersion()0%7280%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun.Annotations/KestrunRuntimeInfo.cs

#LineLine coverage
 1using System.Reflection;
 2using System.Runtime.Versioning;
 3
 4/// <summary>
 5/// Utility class to expose information about the runtime environment
 6/// that Kestrun was built for, and to gate features by TFM and runtime.
 7/// </summary>
 8public static class KestrunAnnotationsRuntimeInfo
 9{
 10    /// <summary>
 11    /// Determines whether the current distribution is a release distribution.
 12    /// </summary>
 13    /// <returns> True if the current distribution is a release distribution; otherwise, false.</returns>
 14#if DEBUG
 15    public static bool IsReleaseDistribution => false;
 16#else
 13017    public static bool IsReleaseDistribution => true;
 18#endif
 19
 20    /// <summary>
 21    /// Determines whether the current build is a debug build.
 22    /// </summary>
 23    /// <returns> True if the current build is a debug build; otherwise, false.</returns>
 024    public static bool IsDebugBuild => !IsReleaseDistribution;
 25
 26    /// <summary>
 27    /// Returns the target framework version this assembly was built against
 28    /// as a System.Version (e.g., 8.0, 9.0).
 29    /// </summary>
 30    public static Version GetBuiltTargetFrameworkVersion()
 31    {
 032        var asm = typeof(KestrunAnnotationsRuntimeInfo).Assembly;
 033        var tfm = asm.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName;
 034        if (string.IsNullOrEmpty(tfm))
 35        {
 036            return new Version(0, 0);
 37        }
 38
 039        var key = "Version=";
 040        var idx = tfm.IndexOf(key, StringComparison.OrdinalIgnoreCase);
 041        if (idx >= 0)
 42        {
 043            var ver = tfm[(idx + key.Length)..].TrimStart('v');
 044            if (Version.TryParse(ver, out var parsed))
 45            {
 046                return parsed;
 47            }
 48        }
 49
 050        return new Version(0, 0);
 51    }
 52}