< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Xml.XmlExceptionHelper
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Xml/XmlExceptionHelper.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 59
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
ThrowXmlException(...)100%110%
ThrowXmlException(...)100%110%
ThrowXmlException(...)100%110%
ThrowXmlException(...)0%440%
ThrowXmlException(...)0%440%
ThrowMaxStringContentLengthExceeded(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Xml/XmlExceptionHelper.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.Globalization;
 5using System.Xml;
 6
 7namespace CoreWCF.Xml
 8{
 9    internal static class XmlExceptionHelper
 10    {
 11        static void ThrowXmlException(XmlDictionaryReader reader, string res)
 12        {
 013            ThrowXmlException(reader, res, null);
 014        }
 15
 16        static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1)
 17        {
 018            ThrowXmlException(reader, res, arg1, null);
 019        }
 20
 21        static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2)
 22        {
 023            ThrowXmlException(reader, res, arg1, arg2, null);
 024        }
 25
 26        static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2, string arg3)
 27        {
 028            string s = SR.Format(res, arg1, arg2, arg3);
 029            IXmlLineInfo lineInfo = reader as IXmlLineInfo;
 030            if (lineInfo != null && lineInfo.HasLineInfo())
 31            {
 032                s += " " + SR.Format(SR.XmlLineInfo, lineInfo.LineNumber, lineInfo.LinePosition);
 33            }
 34
 35            //if (TD.ReaderQuotaExceededIsEnabled())
 36            //{
 37            //    TD.ReaderQuotaExceeded(s);
 38            //}
 39
 040            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(s));
 41        }
 42
 43        static public void ThrowXmlException(XmlDictionaryReader reader, XmlException exception)
 44        {
 045            string s = exception.Message;
 046            IXmlLineInfo lineInfo = reader as IXmlLineInfo;
 047            if (lineInfo != null && lineInfo.HasLineInfo())
 48            {
 049                s += " " + SR.Format(SR.XmlLineInfo, lineInfo.LineNumber, lineInfo.LinePosition);
 50            }
 051            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(s));
 52        }
 53
 54        static public void ThrowMaxStringContentLengthExceeded(XmlDictionaryReader reader, int maxStringContentLength)
 55        {
 056            ThrowXmlException(reader, SR.XmlMaxStringContentLengthExceeded, maxStringContentLength.ToString(NumberFormat
 057        }
 58    }
 59}