Fix bug 4786 test.
[mono.git] / mcs / class / Mono.Data.Tds / Test / bug-4786.cs
index ed44567b40d019b14b7198a20c623f98a82449b1..dbb28b32af08f4e9ea0ff21471e1cf8f948c8499 100644 (file)
@@ -45,6 +45,8 @@ namespace MonoTests.Mono.Data.Tds
     public void CheckNullException() 
     {
 
+    TcpListener Listener = null;
+
        //set up dummy sql listener, if there is a real sql server on this
        //machine at that port, in theory this part will fail, but that's ok
        //becuase something will be listening on the port and that's all we
@@ -53,7 +55,7 @@ namespace MonoTests.Mono.Data.Tds
        try{
                IPAddress hostIP =Dns.GetHostEntry("localhost").AddressList[0];
         IPEndPoint ep = new IPEndPoint(hostIP, 1433);
-        TcpListener Listener = new TcpListener (ep);
+        Listener = new TcpListener (ep);
         Listener.Start ();
        } catch (Exception){
                //ignore