Exception where call Stop "Une exception de première chance de type 'System.ObjectDisposedException' s'est produite dans System.dll"

Oct 18, 2014 at 3:08 PM
Edited Oct 18, 2014 at 3:42 PM
I use your library in a WPF 4.5 project , and when I want to close the DNS server with the Stop function, my interface freezes, and I receive no discontinuously exception of type:
A first chance exception of type ' System.ObjectDisposedException ' occurred in System.dll

I think than this is due , the Dispose function on the tcplistner ?


public DnsServerService()
    {
        _server = new DnsServer(IPAddress.Any, 10, 10, ProcessQuery);
        _server.ExceptionThrown += new EventHandler<ExceptionEventArgs>(server_ExceptionThrown);
    }

    public void Start()
    {
            _server.Start();
    }

    private void server_ExceptionThrown(object sender, ExceptionEventArgs e)
    {
         //no error !!
        System.Diagnostics.Debug.WriteLine("Error : " + e.Exception.Message);
    }


    public void Stop()
    {
        try
        {
                    _server.Stop();
        }
        catch (Exception)
        {
                   //no catch !!!
        }
    }
Oct 18, 2014 at 3:47 PM
With this correctif it's work, thank you lordbah

https://arsofttoolsnet.codeplex.com/discussions/473436
Marked as answer by Auriou on 10/18/2014 at 8:47 AM