Session.FileExists not always throwing exception
Hi,
I am using the WinSCP .Net library and want to bring something to your attention and to get help resolving it. Currently, before downloading a file, I call the Session.FileExists() method to check the existence of a file. I've been doing some testing where I am booting myself from the SFTP server and then making sure I am able to reconnect, retry the download and keep track of successes/failures. Funny thing is that I boot the connection and then the first time through my loop Session.FileExists() doesn't throw an exception, but rather says that the file doesn't exist. Second time through the loop however, the expected exception ("Session has unexpectedly closed") is thrown and handled appropriately. The issue is that I rely on this exception to be thrown so that my retry logic is initiated. I have stepped through my code with a debugger and analyzed my log files to confirm that this is indeed what is happening
I am using the WinSCP .Net library and want to bring something to your attention and to get help resolving it. Currently, before downloading a file, I call the Session.FileExists() method to check the existence of a file. I've been doing some testing where I am booting myself from the SFTP server and then making sure I am able to reconnect, retry the download and keep track of successes/failures. Funny thing is that I boot the connection and then the first time through my loop Session.FileExists() doesn't throw an exception, but rather says that the file doesn't exist. Second time through the loop however, the expected exception ("Session has unexpectedly closed") is thrown and handled appropriately. The issue is that I rely on this exception to be thrown so that my retry logic is initiated. I have stepped through my code with a debugger and analyzed my log files to confirm that this is indeed what is happening