sshnet / sshnet/SSH.NET

Unhandled Exception under Xamarin iOS

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

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

Ngôn ngữ chính
C#
Star
4.4k
Fork
993
Merge trung bình
9 ngày 21 giờ
Pull request đã merge (30 ngày)
1

Mô tả

I'm using ssh.net in a Xamarin iOS application. When connecting to a sftp server with the iOS 's wifi turn off. I got this exception:
Unhandled Exception:
System.ObjectDisposedException: Safe handle has been closed occurred.
I debug the source code and found out that's because under Xamarin iOS
socket.ConnectAsync(args) return false when wifi is turned off.
SocketAbstraction.cs line 63 if (socket.ConnectAsync(args))
Then it run line 83 connectCompleted.Dispose();
At last function ConnectCompleted was called , where the exception occurred.

If I moved line 83 connectCompleted.Dispose() into below if statement like this:

       if (args.SocketError != SocketError.Success)
        {
            var socketError = (int) args.SocketError;

            // dispose Socket
            socket.Dispose();
            // dispose SocketAsyncEventArgs
            args.Dispose();

            // dispose ManualResetEvent
            connectCompleted.Dispose();

            throw new SocketException(socketError);
        }

then this bug is fixed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu trong SocketAbstraction.cs quanh dòng 63, nơi socket.ConnectAsync(args) được xử lý, và dòng 83, nơi connectCompleted được giải phóng. Tái hiện kết nối SFTP của Xamarin iOS khi Wi-Fi bị tắt và theo dõi ConnectCompleted. Hoàn thành khi kết nối thất bại tạo ra lỗi socket như mong đợi mà không có ObjectDisposedException.

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

Đánh giá

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

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.