[Mono-bugs] [Bug 354090] New: Socket.Select throws exception for read-only ILists
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Jan 16 00:54:05 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=354090
Summary: Socket.Select throws exception for read-only ILists
Product: Mono: Class Libraries
Version: 1.2.4
Platform: x86
OS/Version: Kubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: gavin at hexillion.com
QAContact: mono-bugs at lists.ximian.com
CC: gavin at hexillion.com
Found By: Third Party Developer/Partner
The sample code in the Socket.Select documentation passes ArrayLists in as
parameters. However, the method prototype actually specifies ILists, which are
not necessarily mutable. One could argue that mutable ILists should be
required, but the documentation doesn't say that and Microsoft's implementation
accepts read-only ILists (which are replaced during the course of the method
call).
using System;
using System.Collections;
using System.Net.Sockets;
class SelectTest {
public static void Main() {
Socket socket1 =
new Socket(AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp);
Socket[] writeList = new Socket[1];
writeList[0] = socket1;
Socket.Select(null, writeList, null, 10);
Console.WriteLine( "Writeable sockets: {0}",
writeList.Length );
}
}
This code yields "Writeable sockets: 1" on Windows .NET 1.1 but results in the
following on Mono 1.2.4 on (K)Ubuntu:
Unhandled Exception: System.NotSupportedException: Operation is not supported.
at System.Array.System.Collections.IList.Add (System.Object value) [0x00000]
at System.Net.Sockets.Socket.Select (IList checkRead, IList checkWrite, IList
checkError, Int32 microSeconds) [0x00000]
at SelectTest.Main () [0x00000]
For callers, this is easy to work around if they can modify their source code.
It's a stopper if only .NET binaries are available.
Found while testing .NET binaries on Mono.
--
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