SftpClient.Connect() throwing ThreadAbortException
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
public bool Connect()
{
if (!Connected)
{
sftp.Connect(); //Line throw exception
}
return true;
}
Code like this, and it thrown a ThreadAbortException
Exception.TargetSite.Name is WaitMultiple
I use nuget to install ssh.net and that is 2016.1.0
Sometimes I can reproduce.
I get the latest code download from github and then compile, it still can be reproduced.
My Code:
public bool Connect()
{
try
{
if (!Connected)
{
sftp.Connect();
}
return true;
}
catch (System.Threading.ThreadAbortException ex)
{
throw new Exception(string.Format("ThreadAbortException:{0}" + ex.TargetSite.Name, ex.Message));
}
catch (Exception ex)
{
throw new Exception(string.Format("Connect failed:{0}", ex.Message));
}
}
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 with SftpClient.Connect() and the sftp.Connect() call shown in the report, using the supplied connection code and SSH.NET 2016.1.0 or the compiled latest source to attempt reproduction. A complete result would identify the conditions causing ThreadAbortException or provide a confirmed fix, with the intermittent behavior explained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100