Skip to content

Commit

Permalink
The correct net50 #define is NET5_0, not NET50
Browse files Browse the repository at this point in the history
Fixes issue #1140
  • Loading branch information
jstedfast committed Mar 29, 2021
1 parent 88aa900 commit 48c95f0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion MailKit/IMailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public interface IMailService : IDisposable
/// <value>The SSL and TLS protocol versions that are supported.</value>
SslProtocols SslProtocols { get; set; }

#if NET50
#if NET5_0
/// <summary>
/// Gets or sets the cipher suites allowed to be used when negotiating an SSL or TLS connection.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions MailKit/MailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace MailKit {
/// </remarks>
public abstract class MailService : IMailService
{
#if NET48 || NET50
#if NET48 || NET5_0
const SslProtocols DefaultSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;
#else
const SslProtocols DefaultSslProtocols = SslProtocols.Tls12 | (SslProtocols) 12288;
Expand Down Expand Up @@ -147,7 +147,7 @@ protected MailService () : this (new NullProtocolLogger ())
get; set;
}

#if NET50
#if NET5_0
/// <summary>
/// Gets or sets the cipher suites allowed to be used when negotiating an SSL or TLS connection.
/// </summary>
Expand Down Expand Up @@ -420,7 +420,7 @@ protected bool DefaultServerCertificateValidationCallback (object sender, X509Ce
return false;
}

#if NET50
#if NET5_0
/// <summary>
/// Gets the SSL/TLS client authentication options for use with .NET5's SslStream.AuthenticateAsClient() API.
/// </summary>
Expand Down
16 changes: 8 additions & 8 deletions MailKit/Net/Imap/ImapClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,15 +1231,15 @@ async Task ConnectAsync (string host, int port, SecureSocketOptions options, boo

try {
if (doAsync) {
#if NET50
#if NET5_0
await ssl.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
ssl.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
ssl.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1294,15 +1294,15 @@ async Task ConnectAsync (string host, int port, SecureSocketOptions options, boo
engine.Stream.Stream = tls;

if (doAsync) {
#if NET50
#if NET5_0
await tls.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
tls.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
tls.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1437,15 +1437,15 @@ async Task ConnectAsync (Stream stream, string host, int port, SecureSocketOptio

try {
if (doAsync) {
#if NET50
#if NET5_0
await ssl.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
ssl.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
ssl.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1505,15 +1505,15 @@ async Task ConnectAsync (Stream stream, string host, int port, SecureSocketOptio

try {
if (doAsync) {
#if NET50
#if NET5_0
await tls.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
tls.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
tls.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down
16 changes: 8 additions & 8 deletions MailKit/Net/Pop3/Pop3Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -911,15 +911,15 @@ async Task ConnectAsync (string host, int port, SecureSocketOptions options, boo

try {
if (doAsync) {
#if NET50
#if NET5_0
await ssl.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
ssl.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
ssl.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -968,15 +968,15 @@ async Task ConnectAsync (string host, int port, SecureSocketOptions options, boo
engine.Stream.Stream = tls;

if (doAsync) {
#if NET50
#if NET5_0
await tls.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
tls.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
tls.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1102,15 +1102,15 @@ async Task ConnectAsync (Stream stream, string host, int port, SecureSocketOptio

try {
if (doAsync) {
#if NET50
#if NET5_0
await ssl.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
ssl.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
ssl.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1164,15 +1164,15 @@ async Task ConnectAsync (Stream stream, string host, int port, SecureSocketOptio

try {
if (doAsync) {
#if NET50
#if NET5_0
await tls.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
tls.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
tls.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down
16 changes: 8 additions & 8 deletions MailKit/Net/Smtp/SmtpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,15 +1029,15 @@ async Task ConnectAsync (string host, int port, SecureSocketOptions options, boo

try {
if (doAsync) {
#if NET50
#if NET5_0
await ssl.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
ssl.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
ssl.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1087,15 +1087,15 @@ async Task ConnectAsync (string host, int port, SecureSocketOptions options, boo
Stream.Stream = tls;

if (doAsync) {
#if NET50
#if NET5_0
await tls.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
tls.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
tls.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1232,15 +1232,15 @@ async Task ConnectAsync (Stream stream, string host, int port, SecureSocketOptio

try {
if (doAsync) {
#if NET50
#if NET5_0
await ssl.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
ssl.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
ssl.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
ssl.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down Expand Up @@ -1294,15 +1294,15 @@ async Task ConnectAsync (Stream stream, string host, int port, SecureSocketOptio

try {
if (doAsync) {
#if NET50
#if NET5_0
await tls.AuthenticateAsClientAsync (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate), cancellationToken).ConfigureAwait (false);
#else
await tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).ConfigureAwait (false);
#endif
} else {
#if NETSTANDARD1_3 || NETSTANDARD1_6
tls.AuthenticateAsClientAsync (host, ClientCertificates, SslProtocols, CheckCertificateRevocation).GetAwaiter ().GetResult ();
#elif NET50
#elif NET5_0
tls.AuthenticateAsClient (GetSslClientAuthenticationOptions (host, ValidateRemoteCertificate));
#else
tls.AuthenticateAsClient (host, ClientCertificates, SslProtocols, CheckCertificateRevocation);
Expand Down

0 comments on commit 48c95f0

Please sign in to comment.