[Mono-bugs] [Bug 498507] New: mono _sometimes_ doesn't throw ObjectDisposedException when calling socket.Close()
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Apr 27 12:29:49 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=498507
Summary: mono _sometimes_ doesn't throw ObjectDisposedException
when calling socket.Close()
Classification: Mono
Product: Mono: Class Libraries
Version: 2.2.x
Platform: 32bit
OS/Version: Mac OS X 10.5
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: silver83 at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.59 Safari/525.19
Consider the following code, which should display "closed" every time. Under
mono in OS X, sometime, it doesn't - socket.close doesn't induce an
ObjectDisposedException :
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Threading;
using System.Net;
namespace SocketTest
{
class Program
{
static void Main(string[] args)
{
Socket socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
try
{
IAsyncResult async = socket.BeginConnect(new
IPEndPoint(IPAddress.Parse("INEXISTANT_IP_HERE"), 8888), ConnectCallback,
socket);
if (!async.AsyncWaitHandle.WaitOne(3, false))
{
socket.Close();
}
}
catch (Exception se)
{
Console.WriteLine(se.Message);
}
}
private void ConnectCallback(IAsyncResult async)
{
Socket socket = (Socket)async.AsyncState;
try
{
socket.EndConnect(async);
}
catch (ObjectDisposedException)
{
Console.WriteLine("closed");
}
}
}
}
Reproducible: Sometimes
Steps to Reproduce:
1. see above code
2.
3.
Actual Results:
Sometimes prints "closed", sometimes it doesn't
Expected Results:
Always print "closed".
--
Configure bugmail: http://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