System.IO.Pipes.PipeStream.WinIOError C# (CSharp) Méthode

WinIOError() private méthode

private WinIOError ( int errorCode ) : Exception
errorCode int
Résultat Exception
        internal Exception WinIOError(int errorCode)
        {
            switch (errorCode)
            {
                case Interop.Errors.ERROR_BROKEN_PIPE:
                case Interop.Errors.ERROR_PIPE_NOT_CONNECTED:
                case Interop.Errors.ERROR_NO_DATA:
                    // Other side has broken the connection
                    _state = PipeState.Broken;
                    return new IOException(SR.IO_PipeBroken, Win32Marshal.MakeHRFromErrorCode(errorCode));

                case Interop.Errors.ERROR_HANDLE_EOF:
                    return Error.GetEndOfFile();

                case Interop.Errors.ERROR_INVALID_HANDLE:
                    // For invalid handles, detect the error and mark our handle
                    // as invalid to give slightly better error messages.  Also
                    // help ensure we avoid handle recycling bugs.
                    _handle.SetHandleAsInvalid();
                    _state = PipeState.Broken;
                    break;
            }

            return Win32Marshal.GetExceptionForWin32Error(errorCode);
        }
    }

Usage Example

Exemple #1
0
 protected override void HandleError(int errorCode)
 {
     TrySetException(_pipeStream.WinIOError(errorCode));
 }
All Usage Examples Of System.IO.Pipes.PipeStream::WinIOError