// If this class is ever made public, the following methods should
        // remain internal to the library code only.

        internal static void OnUnhandledException(UnhandledTaskExceptionEventArgs args)
        {
            if (args == null) throw new ArgumentNullException(nameof(args));
            UnhandledTaskException?.InvokeAsEventHandlerWhileIgnoringErrors(null, args);
        }