https://bugzilla.novell.com/show_bug.cgi?id=371923


           Summary: Incorrect exception thrown by Net
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: i686
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


NetworkStream(socket) contstructor should throw IOException if socket is not
connected. Instead it throws ArgumentException.

This actually causes hard-to-workaround problems when NetworkStream is used
with other libraries and they expect an IOException but ArgumentException is
thrown.

[EMAIL PROTECTED]:~/beagle/bludgeon> cat a.cs
using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;

class a{
    public static void Main ()
    {
        IPEndPoint ipe = new IPEndPoint(Dns.GetHostEntry
("www.google.com").AddressList [0], 80);
        Socket s = new Socket(ipe.AddressFamily, SocketType.Stream,
ProtocolType.Tcp);
        s.Close ();
        NetworkStream ns = new NetworkStream (s);

    }
}

[EMAIL PROTECTED]:~/beagle/bludgeon> mono a.exe

Unhandled Exception: System.ArgumentException: Not connected
Parameter name: socket
  at System.Net.Sockets.NetworkStream..ctor (System.Net.Sockets.Socket socket,
FileAccess access, Boolean owns_socket) [0x00000] 
  at System.Net.Sockets.NetworkStream..ctor (System.Net.Sockets.Socket socket)
[0x00000] 
  at (wrapper remoting-invoke-with-check)
System.Net.Sockets.NetworkStream:.ctor (System.Net.Sockets.Socket)
  at a.Main () [0x00000]


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to