You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SshException ("Failure") is about to happen as a result of SendRequest(request); call. But by the time if (exception is not null) check is done, the exception variable is still null (because it's set asynchronously after we get the response). So it won't be thrown by throw exception;. That's the case if we just run after breaking on SendRequest(request); line. But if we step over to the if (exception is not null) line, the exception variable gets a chance to be set, and we get that throw exception; executed as it was intended.
This bug makes me unable to catch SshException in my code while using sftpClient.UploadFile().
You can see demos in the GIFs below:
The text was updated successfully, but these errors were encountered:
TishSerg
changed the title
SshException check can yield a wrong result
SshException check yields a wrong result during normal run, but not while stepping in debugger
May 9, 2025
Uh oh!
There was an error while loading. Please reload this page.
SSH.NET 2025.0.0
SshException
("Failure") is about to happen as a result ofSendRequest(request);
call. But by the timeif (exception is not null)
check is done, theexception
variable is stillnull
(because it's set asynchronously after we get the response). So it won't be thrown bythrow exception;
. That's the case if we just run after breaking onSendRequest(request);
line. But if we step over to theif (exception is not null)
line, theexception
variable gets a chance to be set, and we get thatthrow exception;
executed as it was intended.This bug makes me unable to catch
SshException
in my code while usingsftpClient.UploadFile()
.You can see demos in the GIFs below:
The text was updated successfully, but these errors were encountered: