[Mono-list] SocketException: Connection refused not caught by try/catch

Mario Alberto Chavez chavezmarioalberto@msn.com
Wed, 15 Oct 2003 16:33:00 -0700


I've updated mcs and mono from last night (Otc-14) cvs, and now 
System.Net.Sockets.SocketException is not being caught by try/catch. Please 
see test case:
using System;
using System.Data;
using System.Data.SqlClient;

public class Test
{
    public static void Main(string[] args)
    {
	// Use a dummy server IP address
       string connectionString =
          "Server=10.128.9.10;" +
          "Database=pubs;" +
          "User ID=myuserid;" +
          "Password=mypassword;";
	try{
		IDbConnection dbcon;
       		dbcon = new SqlConnection(connectionString);

		Console.WriteLine("Openning connection...");
		dbcon.Open();
		dbcon.Close();
	        dbcon = null;
		Console.WriteLine("Closing connection...");
	}catch(Exception e){
		Console.WriteLine("Opps, no server");
	}
    }
}

mcs connection.cs -r System.Data.dll
mono connection.exe
Openning connection...

Unhandled Exception: System.Net.Sockets.SocketException: Connection refused

Regards,

Mario A Chavez Cardenas
chavezmarioalberto@msn.com

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.yupimsn.com/