Authentication failure after upgrading to .NET 4 (due to changes in Dns.GetHostEntry)


Pop3Client stopped working on one of our servers after upgrading to .NET 4. I downloaded the code and found that the issue is caused by Dns.GetHostEntry behavior change in .NET 4 ( https://connect.microsoft.com/VisualStudio/feedback/details/561083 ).
1) Both GetHostEntry() and TryGetTcpClient() swallow all exceptions, so there is no simple way to debug connection errors.
It would be nice to have an alternative to Authenticate() method that (re)throws exceptions.
2) Is it possible to change Dns.GetHostEntry to Dns.GetHostAddresses?
This is what I had to change to make GetTcpClient() method work in my case:
var addressList = Dns.GetHostAddresses(this._ServerName);
foreach (var address in addressList)
tc = this.TryGetTcpClient(address);
if (tc != null)
Closed Dec 12, 2011 at 3:38 AM by higty
I created for .net 4 version.Please check latest version.


higty wrote Oct 5, 2010 at 1:56 PM

Thank your proposal.
I'll plan to create .net 4 version but it will take a few days or week.
Please wait for it.

wrote Dec 12, 2011 at 3:38 AM

wrote Feb 14, 2013 at 6:38 PM

wrote May 16, 2013 at 8:35 AM