< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.ProtocolException
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/ProtocolException.cs
Line coverage
13%
Covered lines: 2
Uncovered lines: 13
Coverable lines: 15
Total lines: 43
Line coverage: 13.3%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%110%
ReceiveShutdownReturnedNonNull(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/ProtocolException.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.Globalization;
 6using System.Runtime.Serialization;
 7using CoreWCF.Channels;
 8
 9namespace CoreWCF
 10{
 11    [Serializable]
 12    public class ProtocolException : CommunicationException
 13    {
 014        public ProtocolException() { }
 215        public ProtocolException(string message) : base(message) { }
 216        public ProtocolException(string message, Exception innerException) : base(message, innerException) { }
 017        protected ProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { }
 18
 19        internal static ProtocolException ReceiveShutdownReturnedNonNull(Message message)
 20        {
 021            if (message.IsFault)
 22            {
 23                try
 24                {
 025                    MessageFault fault = MessageFault.CreateFault(message, 64 * 1024);
 026                    FaultReasonText reason = fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture);
 027                    string text = SR.Format(SRCommon.ReceiveShutdownReturnedFault, reason.Text);
 028                    return new ProtocolException(text);
 29                }
 030                catch (QuotaExceededException)
 31                {
 032                    string text = SR.Format(SRCommon.ReceiveShutdownReturnedLargeFault, message.Headers.Action);
 033                    return new ProtocolException(text);
 34                }
 35            }
 36            else
 37            {
 038                string text = SR.Format(SRCommon.ReceiveShutdownReturnedMessage, message.Headers.Action);
 039                return new ProtocolException(text);
 40            }
 041        }
 42    }
 43}