I've got a Xamarin app built with VisualStudio 2022 and running on an Android R device. I'm pulling the libraries into my project using NuGet and setting the correct license in code.
Here's the function that's getting an error:
public void UploadFile(string localFileName, string remoteFileName)
{
try
{
if (Login())
{
mSFTP.Settings.EnableBrokenDirectoryStatWorkaround = true;
String[] split = remoteFileName.Split(new Char[] { '/' });
mSFTP.ChangeDirectory(split[0]);
mTransferInProgress = true;
mSFTP.PutFile(localFileName, split[1]);
}
}
catch (SftpException ex)
{
ThrowAnException(ex, UlSftpTransferType.Upload, localFileName, remoteFileName);
}
finally
{
m_TransferInProgress = false;
}
}
The local pathname exists and is accessible. The remote directory exists and the call to ChangeDirectory() succeeds. The call to PutFile(), though, returns an exception:
ex {Rebex.Net.SftpException} Rebex.Net.SftpException
base {Rebex.Net.NetworkSessionException} Rebex.Net.NetworkSessionException
Code Rebex.Net.SftpErrorCode.NoSuchFile Rebex.Net.SftpErrorCode
LocalPath (null) string
ProblemType 0 Rebex.IO.TransferProblemType
RemotePath (null) string
Status Rebex.Net.SftpExceptionStatus.ProtocolError Rebex.Net.SftpExceptionStatus
Transferred 0 long
This was occurring with the previous version of Rebex (R5.1) and is still occurring with version 7.0.8816.
I added the line of code to set EnableBrokenDirectoryStatWorkaround as per another suggestion I found but that doesn't appear to work.
Any ideas what this exception means and how I can correct the problem? Thanks.