< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.MsmqDecodeHelper
Assembly: CoreWCF.MSMQ
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/MsmqDecodeHelper.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 50
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
DecodeTransportDatagram()0%660%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/MsmqDecodeHelper.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.IO.Pipelines;
 5using System.Threading.Tasks;
 6using Microsoft.Extensions.Logging.Abstractions;
 7
 8namespace CoreWCF.Channels
 9{
 10    public static class MsmqDecodeHelper
 11    {
 12        private const int DefaultMaxViaSize = 2048;
 13        private const int DefaultMaxContentTypeSize = 256;
 14
 15        public static async Task DecodeTransportDatagram(PipeReader pipeReader)
 16        {
 017            var serverModeDecoder = new ServerModeDecoder(NullLogger.Instance);
 018            await serverModeDecoder.ReadModeAsync(pipeReader);
 019            var decoder =
 020                new ServerSingletonSizedDecoder(DefaultMaxViaSize, DefaultMaxContentTypeSize, NullLogger.Instance);
 021            var readResult = await pipeReader.ReadAsync();
 022            if (readResult.IsCompleted)
 23            {
 024                return;
 25            }
 26
 027            var buffer = readResult.Buffer;
 28
 29            try
 30            {
 31                do
 32                {
 033                    if (buffer.Length <= 0)
 34                    {
 035                        throw decoder.CreatePrematureEOFException();
 36                    }
 37
 038                    int decoded = decoder.Decode(buffer);
 039                    buffer = buffer.Slice(decoded);
 040                } while (decoder.CurrentState != ServerSingletonSizedDecoder.State.Start);
 41
 042                pipeReader.AdvanceTo(buffer.Start);
 043            }
 044            catch (ProtocolException ex)
 45            {
 046                throw new MsmqPoisonMessageException(0, ex);
 47            }
 048        }
 49    }
 50}

Methods/Properties

DecodeTransportDatagram()