} // end WriteError()

        internal void WriteError(ErrorRecord er, bool alreadyLogged)
        {
            if (!alreadyLogged)
            {
                DbgProvider.LogError(er);
            }

            ((PSCmdlet)this).WriteError(er);
        } // end WriteError()
 protected void SafeWriteError(ErrorRecord er)
 {
     DbgProvider.LogError(er);
     if (IsOnPipelineThread)
     {
         IgnorePipelineStopped(() => WriteError(er, true));
     }
     else
     {
         m_msgLoop.Post(() => WriteError(er, true));
     }
 }