SftpClient upload file doesn't work in UWP and Console applications.
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
We are trying to upload a file in our UWP application and Console applications.
Connecting seems to work fine but uploading doesn't. It always creates a 0 byte file.
The upload callback is never executed and it ends immediately even for a file of a couple of mb's.
await Task.Run(async () =>
{
string fileName = "foo.tar";
string filePath = $"/mnt/userdata/{fileName}";
var sshPassword = "test";
var stream = await file.OpenStreamForReadAsync();
var sftpClient = new SftpClient(ipAddress, "root", sshPassword);
sftpClient.Connect();
sftpClient.UploadFile(
stream,
filePath ,
uploaded =>
{
Console.WriteLine($"Uploaded {(double)uploaded / stream.Length * 100}% of the file.");
});
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided SftpClient.UploadFile example in a UWP or Console application and inspect the upload behavior and callback execution. Done means the file is uploaded with its expected size and the progress callback runs; the payload names no repository files or tests to begin with.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100