private static byte[] ReadByteArrayFromStream(Stream stream)
        {
            int num = MessageTraceCollapsedProperty.ReadLengthFromStream(stream);

            byte[] array = new byte[num];
            if (stream.Read(array, 0, num) != num)
            {
                throw new InvalidOperationException(string.Format("Unable to read byte array of {0} length from stream. End of stream reached.", num));
            }
            return(array);
        }