From 62f67c6bcf09f38fda58a087f8fed05effb16732 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 6 Dec 2019 11:11:14 +0100 Subject: [PATCH] Remove try-catch from SmtpClient.Abort to see what Exceptions get caught. --- .../src/System/Net/Mail/SmtpClient.cs | 15 +++++++++------ .../src/System/Net/Mail/SmtpConnection.cs | 5 ----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs index 077bfeb57175f2..de694d9883af21 100644 --- a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs +++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.cs @@ -1080,13 +1080,16 @@ private void GetConnection() private void Abort() { - try - { + // Try-catch commented out to identify exception that is causing + // https://github.com/dotnet/corefx/issues/40711. + + // try + // { _transport.Abort(); - } - catch - { - } + // } + // catch + // { + // } } public void Dispose() diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs index 9344213752c700..2d93f09b73e234 100644 --- a/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs +++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs @@ -40,9 +40,6 @@ internal partial class SmtpConnection private readonly ChannelBinding _channelBindingToken = null; private bool _enableSsl; private X509CertificateCollection _clientCertificates; -#pragma warning disable CS0414 - private bool _aborted; // Tracks whether Abort was called, for debugging https://github.com/dotnet/corefx/issues/40711. -#pragma warning restore CS0414 internal SmtpConnection(SmtpTransport parent, SmtpClient client, ICredentialsByHost credentials, ISmtpAuthenticationModule[] authenticationModules) { @@ -154,8 +151,6 @@ internal void ReleaseConnection() internal void Abort() { - _aborted = true; - if (!_isClosed) { lock (this)