Skip to content

Commit

Permalink
Remove more ERROR_HANDLE_EOF validations from Write* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jozkee committed Mar 22, 2021
1 parent 1d38808 commit ff4e862
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,7 @@ private unsafe Task WriteAsyncInternalCore(ReadOnlyMemory<byte> source, Cancella
}

completionSource.ReleaseNativeResource();

if (errorCode == ERROR_HANDLE_EOF)
{
ThrowHelper.ThrowEndOfFileException();
}
else
{
throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
}
throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
}
else if (cancellationToken.CanBeCanceled) // ERROR_IO_PENDING
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1037,15 +1037,7 @@ private unsafe Task WriteAsyncInternalCore(ReadOnlyMemory<byte> source, Cancella
}

completionSource.ReleaseNativeResource();

if (errorCode == ERROR_HANDLE_EOF)
{
ThrowHelper.ThrowEndOfFileException();
}
else
{
throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
}
throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
}
else if (cancellationToken.CanBeCanceled) // ERROR_IO_PENDING
{
Expand Down

0 comments on commit ff4e862

Please sign in to comment.