A unexpected error when I disconnected

Feb 4, 2010 at 9:38 AM

I have make a small application (in c#) which scans periodically the available networks.

The application works the 99% of the time, but sometimes when the connection goes down, a windows error appear. I try putting try catch everywhere, but I didn't work.

Some test later I can say that this application, when the connection goes down sometimes gives an error:

class Program

{
    static void Main(string[] args)
    {
        WlanClient client = new WlanClient();
        while (true)
        {
            Console.WriteLine("Interface: " + client.Interfaces.Length);
            Thread.Sleep(500);
        }
    }
}

¿Any solution? I tried putting try catch, but it didn't work.