This project is read-only.


can't get smtp server to cleanly stop


I am using VS2008 unit tests to verify that my code can send emails using System.Net.SmtpClient and RnWood.SmtpServer. The unit test starts up the smtp server on localhost then successfully runs one test. Each send test reads the message data so the test can assert the subject/body/recipients were done properly. Once each tests completes, the smtp server is stopped and the next test is started. This is where things go a muck.
For some reason when the smtp server is stopped there is still a connection with a blocking IO operation pending here:
public string ReadLine()
        string text = _reader.ReadLine();  //blocking IO operation here
        return text;
So we never get a clean shutdown of the smtp server and test host. Subsequent unit tests fail with bizarre "Failed to acquire a WriterLock" from the Unit Test Host.


rnwood wrote Jun 17, 2010 at 8:35 AM

Thanks for reporting this issue.
As you've noted stopping the server currently does not handle shutting down the worker threads. This is something I'd like to address and will look and will post a fix for shortly.

wrote Aug 18, 2011 at 7:03 AM

wrote Feb 14, 2013 at 12:41 AM

wrote May 16, 2013 at 5:02 AM

wrote May 16, 2013 at 5:02 AM

wrote Jun 14, 2013 at 8:43 AM