/// <summary>
        /// Get the <see cref="RunspaceHandle" /> for the current <see cref="PromptNestFrame" />.
        /// </summary>
        /// <param name="cancellationToken">
        /// The <see cref="CancellationToken" /> that can be used to cancel the request.
        /// </param>
        /// <param name="isReadLine">Indicates whether this is for a PSReadLine command.</param>
        /// <returns>The <see cref="RunspaceHandle" /> for the current frame.</returns>
        internal RunspaceHandle GetRunspaceHandle(CancellationToken cancellationToken, bool isReadLine)
        {
            if (_isDisposed)
            {
                return(null);
            }

            // Also grab the main runspace handle if this is for a ReadLine pipeline and the runspace
            // is in process.
            if (isReadLine && !_powerShellContext.IsCurrentRunspaceOutOfProcess())
            {
                GetRunspaceHandleImpl(cancellationToken, isReadLine: false);
            }

            return(GetRunspaceHandleImpl(cancellationToken, isReadLine));
        }