ThrowHelper
using System.Runtime.CompilerServices;
namespace System
{
    internal static class ThrowHelper
    {
        [System.Runtime.CompilerServices.NullableContext(2)]
        internal static void ThrowIfNull(object argument, [System.Runtime.CompilerServices.CallerArgumentExpression("argument")] string paramName = null)
        {
            if (argument == null)
                Throw(paramName);
        }
        private static void Throw(string paramName)
        {
            throw new ArgumentNullException(paramName);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        [System.Runtime.CompilerServices.NullableContext(1)]
        public static string IfNullOrWhitespace([System.Runtime.CompilerServices.Nullable(2)] string argument, [System.Runtime.CompilerServices.CallerArgumentExpression("argument")] string paramName = "")
        {
            if (argument == null)
                throw new ArgumentNullException(paramName);
            if (string.IsNullOrWhiteSpace(argument)) {
                if (argument == null)
                    throw new ArgumentNullException(paramName);
                throw new ArgumentException(paramName, "Argument is whitespace");
            }
            return argument;
        }
    }
}