Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

'The session is not open' in ListDirectoryAsync

Đang mở
#1,753 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
csharp
Lĩnh vực
networking

Hướng nghiên cứu

Bắt đầu từ SftpClient.ListDirectoryAsync và lần theo đường dẫn được báo cáo qua SftpSession.GetCanonicalPathAsync và SftpSession.SendRequest. Hãy thử tái hiện lỗi với nhiều instance SftpClient sử dụng cùng thông tin xác thực khi liệt kê các thư mục khác nhau, đồng thời kiểm tra vòng đời của session xung quanh ConnectAsync, ListDirectoryAsync và Disconnect. Công việc được xem là hoàn tất khi lỗi hiếm gặp 'The session is not open' được hiểu rõ và được bao phủ bởi một test đáng tin cậy hoặc một giới hạn được ghi chép.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

On rare occasions, I see 'The session is not open' in ListDirectoryAsync.
The last time I saw it, it was for a server where multiple instances of sftpClient might get created simultaneously with the same username/password, but working with different folders.

SSH.NET 2025.1.0 .Net 9.

My code looks like this:

try
{
    await sftpClient.ConnectAsync(cancellationToken);
	
    await sftpClient.ChangeDirectoryAsync(path, cancellationToken);
    var asyncList = sftpClient.ListDirectoryAsync(path, cancellationToken);
}
finally
{
	if (sftpClient.IsConnected)
		sftpClient.Disconnect();
}

"Type": "System.InvalidOperationException",
"HResult": -2146233079,
"Message": "The session is not open.",
"Source": "Renci.SshNet",
"StackTrace": " at Renci.SshNet.Sftp.SftpSession.SendRequest(SftpRequest request)\r\n at Renci.SshNet.Sftp.SftpSession.GetCanonicalPathAsync(String path, CancellationToken cancellationToken)\r\n at Renci.SshNet.SftpClient.ListDirectoryAsync(String path, CancellationToken cancellationToken)+MoveNext()\r\n at Renci.SshNet.SftpClient.ListDirectoryAsync(String path, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource.GetResult()",
"TargetSite": "Void SendRequest(Renci.SshNet.Sftp.Requests.SftpRequest)"

Ngôn ngữ chính
C#
Star
4.4k
Fork
990
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sshnet/SSH.NET

Tất cả issue của sshnet/SSH.NET

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.