Possible bug in Session.PutFile

Advertisement

wild-cursor
Joined:
Posts:
1
Location:
Pakistan

Possible bug in Session.PutFile

I have been using this client for some time. It's an awesome library.
I am doing a simple upload via streaming.
Usually, when I am uploading I use the physical path method as I have the file physically.
Currently, I am downloading the file from one location and uploading it to another location.
Using this method avoids creating unnecessary files locally.

I am getting an error on this line.
https://github.com/winscp/winscp/blob/5.18.2-beta/dotnet/Session.cs#L823

I am not familiar with the internals but I looking at code.
I think this check is incorrect.
this._process.StdIn is going to be null in the beginning.

Below is my code for calling this method.
https://winscp.net/eng/docs/library_session_putfile

public void UploadFile(Stream stream, string remotePath)
{
    // Setup session options
    var sessionOptions = new SessionOptions
    {
        Protocol = Protocol.Ftp,
        HostName = FtpHostName,
        UserName = FtpUser,
        Password = FtpPassword
    };
 
    using Session session = new Session();
    // Connect
    session.Open(sessionOptions);
 
    if (session.Opened)
    {
        session.PutFile(stream, remotePath);
    }
}

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,066
Location:
Prague, Czechia

Re: Possible bug in Session.PutFile

What version of WinSCP are you using? Do you have the latest one? Please set Session.DebugLogPath and attach a complete debug log showing the problem. Also a complete exception callstack.

Reply with quote

Advertisement

You can post new topics in this forum