Skip to content

Use ReadExactly in ReadAllBytes and yield in ReadLines #1681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 2, 2025

Conversation

Rob-Hague
Copy link
Collaborator

  • SftpClient.ReadAllBytes does one call to SftpFileStream.Read. This is fine because SftpFileStream.Read currently fills the caller's buffer, but it may not always be the case, so for correctness we call ReadExactly (polyfilled on lower targets).

  • IEnumerable<string> ReadLines currently calls string[] ReadAllLines. We invert this relationship so that ReadLines enumerates lazily. This is fine by contract but may cause behavioural breaks. Will call it out in release notes.

@Rob-Hague Rob-Hague merged commit 605ee7f into sshnet:develop Aug 2, 2025
4 checks passed
@Rob-Hague Rob-Hague deleted the readallbytes branch August 2, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants