[Mono-bugs] [Bug 76915][Nor] Changed - Crash while accessing System.Net.Sockets.SocketException.SocketErrorCode

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Dec 6 12:56:16 EST 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by thetrick at gmx.net.

http://bugzilla.ximian.com/show_bug.cgi?id=76915

--- shadow/76915	2005-12-05 16:37:52.000000000 -0500
+++ shadow/76915.tmp.2283	2005-12-06 12:56:16.000000000 -0500
@@ -69,6 +69,48 @@
 
 ------- Additional Comments From dick at ximian.com  2005-12-05 16:37 -------
 Please tell us the version of mono you are using, and also attach a
 small self-contained test case that demonstrates the issue.  I know a
 simple socket test is trivial but it's important that I test the same
 thing you are seeing.  Thanks.
+
+------- Additional Comments From thetrick at gmx.net  2005-12-06 12:56 -------
+i'm using Mono JIT compiler version 1.1.10
+
+this small program crashes, even if there didn't even occure an
+exception...
+
+using System;
+using System.Text;
+using System.Net.Sockets;
+
+namespace MonoSockets
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            Socket socket;
+
+            Console.WriteLine("Creating socket...");
+
+            try { socket = new
+Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); }
+            catch (SocketException e)
+            {
+                // next line causes a crash, even if no exception
+occured!!!
+                // just accessing the SocketErrorCode member of
+SocketException seems to be enough
+                if (e.SocketErrorCode == SocketError.SocketError)   
+                    Console.WriteLine("SocketError");
+
+                socket = null;
+                throw new Exception("Couldn't create socket", e);
+            }
+            socket.Close();
+
+            Console.WriteLine("Socket closed...");
+        }
+    }
+}
+


More information about the mono-bugs mailing list