Skip to content

WriteAllBytes don't work in 2016 version #220

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

Closed
roarjoss opened this issue May 10, 2017 · 4 comments
Closed

WriteAllBytes don't work in 2016 version #220

roarjoss opened this issue May 10, 2017 · 4 comments

Comments

@roarjoss
Copy link

roarjoss commented May 10, 2017

Hello,
I discovered an issue uploading files.
I upload a csv file with column headers.
What happens is that the column headers are repeated when the buffer size is reached.
Increasing the buffer size to larger than the pushes the problem further into the file but does not provide a workaround.
Reverting to the 2013 version of the library seems to provide a workaround.
So the bug was introduced after version 2013.4.7.0

Here is my code. The problem occurs around the 4k in the file, the column header at the start of the file is repated 4k into the file.
I verified that the problem is not in my data.
The problem occurs only when uploading.

public string UploadByteArray(string ftppath, byte[] databuffer)
{
using (var client = new SftpClient(HostName, UserName, Password))
{
client.Connect();
Console.WriteLine("Connected to {0}", HostName);

			client.BufferSize = 4 * 1024;
			client.WriteAllBytes(ftppath, databuffer);
			client.Disconnect();
		}
		return null;
	}
@roarjoss roarjoss changed the title Upload don't work when buffer size is smaller than file size Upload don't work in 2016 version May 10, 2017
@roarjoss roarjoss changed the title Upload don't work in 2016 version WriteAllBytes don't work in 2016 version May 10, 2017
@kasbst
Copy link

kasbst commented May 10, 2017

@roarjoss : Did you try also version 2016.1.0-beta1? Check #124 #116 and #218

@BobLokerse
Copy link

@roarjoss Did it work with version 2016.1.0-beta1?

Just waiting for the that version to come out of beta.

@roarjoss
Copy link
Author

roarjoss commented May 22, 2017

When I both use 2016.1.0-beta1 and set buffer size to larger than filesize it worked.

I think there might still be some issue with 2016.1.0-beta1 if buffer size is smaller than file size.
A customer reported that the file file content was duplicated with 4k buffer and 300k file size, the file content was written twice. The first half was correct, the second half a duplicate of the first.
This only happens sometimes.

@drieseng drieseng added this to the 2016.1.0-beta1 milestone Jul 18, 2017
@drieseng
Copy link
Member

drieseng commented Jul 18, 2017

Duplicate of issue #70.

A new beta will be available soon, and final release shortly after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants