/// <summary>
        ///     Validates this instance.
        /// </summary>
        public override void Validate()
        {
            var bodyContentVariationsCount = 0;

            if (Trace != null)
            {
                Trace.Validate();
                bodyContentVariationsCount++;
            }

            if (TraceChain != null && TraceChain.Length > 0)
            {
                bodyContentVariationsCount++;
            }
            if (Message != null)
            {
                Message.Validate();
                bodyContentVariationsCount++;
            }

            if (CrashReport != null)
            {
                bodyContentVariationsCount++;
            }

            Assumption.AssertEqual(bodyContentVariationsCount, 1, nameof(bodyContentVariationsCount));
        }
        /// <summary>
        /// Truncates the specified input.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="encoding">The encoding.</param>
        /// <param name="encodedBytesLimit">The encoded bytes limit.</param>
        /// <returns></returns>
        public static string Truncate(string input, Encoding encoding, int encodedBytesLimit)
        {
            if (input == null)
            {
                return(input);                //nothing to truncate...
            }

            byte[] inputEncodedBytes = encoding.GetBytes(input);
            Assumption.AssertEqual(inputEncodedBytes.Length, encoding.GetByteCount(input), nameof(inputEncodedBytes.Length));
            if (inputEncodedBytes.Length <= encodedBytesLimit)
            {
                return(input);                //nothing to truncate...
            }

            int truncationIndicatorTotalBytes = encoding.GetByteCount(TruncationIndicator);
            int totalBytes = encodedBytesLimit - truncationIndicatorTotalBytes;

            if (totalBytes < 0)
            {
                totalBytes = 0;
            }
            string truncatedInput = encoding.GetString(inputEncodedBytes, 0, totalBytes);

            if ((totalBytes > 0) &&
                (truncatedInput[truncatedInput.Length - 1] != input[truncatedInput.Length - 1])
                )
            {
                truncatedInput = truncatedInput.Substring(0, truncatedInput.Length - 1);
            }

            truncatedInput += TruncationIndicator;

            Assumption.AssertTrue(encoding.GetByteCount(
                                      truncatedInput) <= encodedBytesLimit || encodedBytesLimit < truncationIndicatorTotalBytes,
                                  nameof(truncatedInput)
                                  );

            return(truncatedInput);
        }