[Mono-bugs] [Bug 371923] New: Incorrect exception thrown by Net

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Mar 17 21:00:32 EDT 2008


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: mono-bugs at lists.ximian.com
        ReportedBy: dbera.web at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          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.

linux at cs10-dhcp120:~/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);

    }
}

linux at cs10-dhcp120:~/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.


More information about the mono-bugs mailing list