Repository: Azure/azure-sdk-for-net
File: sdk/core/Azure.Core/src/DynamicData/DynamicData.Operators.cs (C#)

Code before:
            if (value is null) return null;

            try
            {
                return value._element.GetString();
            }
            catch (InvalidOperationException e)
            {
                throw new InvalidCastException(GetInvalidKindExceptionText(typeof(string), value._element), e);
            }
        }

        /// <summary>
        /// Converts the value to a <see cref="byte"/>.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        public static implicit operator byte(DynamicData value)
        {
            if (value is null) return 0;
            try
            {
                return value!._element.GetByte();
            }
            catch (InvalidOperationException e)
            {
                throw new InvalidCastException(GetInvalidKindExceptionText(typeof(byte), value!._element), e);
            }
            catch (FormatException formatException)
            {
                throw new InvalidCastException(GetInvalidFormatExceptionText(typeof(byte), value!._element), formatException);
            }
        }

        /// <summary>
        /// Converts the value to a <see cref="sbyte"/>.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        public static implicit operator sbyte(DynamicData value)
        {
            if (value is null) return default;
            try
            {
                return value!._element.GetSByte();
            }
            catch (InvalidOperationException e)
            {
                throw new InvalidCastException(GetInvalidKindExceptionText(typeof(sbyte), value!._element), e);
            }
            catch (FormatException formatException)
            {
                throw new InvalidCastException(GetInvalidFormatExceptionText(typeof(sbyte), value!._element), formatException);

Review comment (suggestion):
@copilot: Our stated goal is "Don't throw from implicit casts."    Explain what scenarios would hit this block.

Code after:
        public static implicit operator string?(DynamicData? value)
        {
            if (value is null)
            {
                return null;
            }

            try
            {
                return value._element.GetString();
            }
            catch (InvalidOperationException e)
            {
                throw new InvalidCastException(GetInvalidKindExceptionText(typeof(string), value._element), e);
            }
        }

        /// <summary>
        /// Converts the value to a <see cref="byte"/>.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        public static implicit operator byte(DynamicData value)
        {
            if (value is null)
            {
                return default;
            }

            try
            {
                return value._element.GetByte();
            }
            catch (InvalidOperationException e)
            {
                throw new InvalidCastException(GetInvalidKindExceptionText(typeof(byte), value._element), e);
            }
            catch (FormatException formatException)
            {
                throw new InvalidCastException(GetInvalidFormatExceptionText(typeof(byte), value._element), formatException);
            }
        }

        /// <summary>
        /// Converts the value to a <see cref="sbyte"/>.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        public static implicit operator sbyte(DynamicData value)
        {
            if (value is null)
            {
                return default;