< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Diagnostics.TraceUtility
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Diagnostics/TraceUtility.cs
Line coverage
33%
Covered lines: 2
Uncovered lines: 4
Coverable lines: 6
Total lines: 74
Line coverage: 33.3%
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
ThrowHelperError(...)100%11100%
ThrowHelperError(...)100%110%
TraceUserCodeException(...)100%110%
TraceDroppedMessage(...)100%11100%
ThrowHelperArgumentNull(...)100%110%
ThrowHelperWarning(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Diagnostics/TraceUtility.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;
 5using System.Reflection;
 6using CoreWCF.Channels;
 7using CoreWCF.Dispatcher;
 8
 9namespace CoreWCF.Diagnostics
 10{
 11    // TODO: Work out how TraceUtility fits in with all the other exception and tracing classes
 12    internal static class TraceUtility
 13    {
 14        internal static Exception ThrowHelperError(Exception exception, Message message)
 15        {
 16            // If the message is closed, we won't get an activity
 17            //Guid activityId = TraceUtility.ExtractActivityId(message);
 18            //if (DiagnosticUtility.ShouldTraceError)
 19            //{
 20            //    DiagnosticUtility.DiagnosticTrace.TraceEvent(TraceEventType.Error, TraceCode.ThrowingException, Genera
 21            //        TraceSR.Format(TraceSR.ThrowingException), null, exception, activityId, null);
 22            //}
 1523            return exception;
 24        }
 25
 26        internal static Exception ThrowHelperError(Exception exception, Guid activityId, object source)
 27        {
 28            //if (DiagnosticUtility.ShouldTraceError)
 29            //{
 30            //    DiagnosticUtility.DiagnosticTrace.TraceEvent(TraceEventType.Error, TraceCode.ThrowingException, Genera
 31            //        TraceSR.Format(TraceSR.ThrowingException), null, exception, activityId, source);
 32            //}
 033            return exception;
 34        }
 35
 36        internal static void TraceUserCodeException(Exception e, MethodInfo method)
 37        {
 38            //if (DiagnosticUtility.ShouldTraceWarning)
 39            //{
 40            //    StringTraceRecord record = new StringTraceRecord("Comment",
 41            //        SR.Format(SR.SFxUserCodeThrewException, method.DeclaringType.FullName, method.Name));
 42            //    DiagnosticUtility.DiagnosticTrace.TraceEvent(TraceEventType.Warning,
 43            //        TraceCode.UnhandledExceptionInUserOperation, GenerateMsdnTraceCode(TraceCode.UnhandledExceptionInU
 44            //        SR.Format(SR.TraceCodeUnhandledExceptionInUserOperation, method.DeclaringType.FullName, method.Nam
 45            //        record,
 46            //        e, null);
 47            //}
 048        }
 49
 50        internal static void TraceDroppedMessage(Message requestMessage, EndpointDispatcher endpoint)
 51        {
 52            //if (DiagnosticUtility.ShouldTraceInformation)
 53            //{
 54            //    EndpointAddress endpointAddress = null;
 55            //    if (dispatcher != null)
 56            //    {
 57            //        endpointAddress = dispatcher.EndpointAddress;
 58            //    }
 59            //    TraceUtility.TraceEvent(TraceEventType.Information, TraceCode.DroppedAMessage,
 60            //        SR.Format(SR.TraceCodeDroppedAMessage), new MessageDroppedTraceRecord(message, endpointAddress));
 61            //}
 262        }
 63
 64        internal static Exception ThrowHelperArgumentNull(string v, Message message)
 65        {
 066            return new Exception(v);
 67        }
 68
 69        internal static Exception ThrowHelperWarning(Exception exception, Message request)
 70        {
 071            return exception;
 72        }
 73    }
 74}