From a2460cb466c665626b6dfc66d2f36edf4378bf8b Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 9 Dec 2023 20:33:34 -0500 Subject: [PATCH] Disable SERIALIZABLE for net8.0 --- MailKit/MailKit.csproj | 4 ++-- MailKit/MailKitLite.csproj | 4 ++-- UnitTests/ExceptionTests.cs | 4 ++++ UnitTests/Net/Imap/ImapCommandExceptionTests.cs | 4 ++++ UnitTests/Net/Pop3/Pop3CommandExceptionTests.cs | 4 ++++ UnitTests/Net/Proxy/ProxyProtocolExceptionTests.cs | 4 ++++ UnitTests/Net/Smtp/SmtpCommandExceptionTests.cs | 4 ++++ UnitTests/Net/Smtp/SmtpProtocolExceptionTests.cs | 4 ++++ UnitTests/Security/AuthenticationExceptionTests.cs | 4 ++++ UnitTests/Security/SaslExceptionTests.cs | 3 +++ UnitTests/Security/SslHandshakeExceptionTests.cs | 4 ++++ 11 files changed, 39 insertions(+), 4 deletions(-) diff --git a/MailKit/MailKit.csproj b/MailKit/MailKit.csproj index ad371aa597..42b6b1e4ee 100644 --- a/MailKit/MailKit.csproj +++ b/MailKit/MailKit.csproj @@ -45,8 +45,8 @@ full - - + + $(DefineConstants);SERIALIZABLE diff --git a/MailKit/MailKitLite.csproj b/MailKit/MailKitLite.csproj index c92f326c16..9f8129011d 100644 --- a/MailKit/MailKitLite.csproj +++ b/MailKit/MailKitLite.csproj @@ -46,8 +46,8 @@ full - - + + $(DefineConstants);SERIALIZABLE diff --git a/UnitTests/ExceptionTests.cs b/UnitTests/ExceptionTests.cs index 10e1e1228b..ac591c4ccb 100644 --- a/UnitTests/ExceptionTests.cs +++ b/UnitTests/ExceptionTests.cs @@ -24,6 +24,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MailKit; @@ -342,3 +344,5 @@ public void TestPop3ProtocolException () } } } + +#endif // NET6_0 diff --git a/UnitTests/Net/Imap/ImapCommandExceptionTests.cs b/UnitTests/Net/Imap/ImapCommandExceptionTests.cs index 4cb283fabf..302ca51694 100644 --- a/UnitTests/Net/Imap/ImapCommandExceptionTests.cs +++ b/UnitTests/Net/Imap/ImapCommandExceptionTests.cs @@ -25,6 +25,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MailKit.Net.Imap; @@ -73,3 +75,5 @@ public void TestImapCommandException () } } } + +#endif // NET6_0 diff --git a/UnitTests/Net/Pop3/Pop3CommandExceptionTests.cs b/UnitTests/Net/Pop3/Pop3CommandExceptionTests.cs index d588bfc41d..195a6262f5 100644 --- a/UnitTests/Net/Pop3/Pop3CommandExceptionTests.cs +++ b/UnitTests/Net/Pop3/Pop3CommandExceptionTests.cs @@ -24,6 +24,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MailKit.Net.Pop3; @@ -94,3 +96,5 @@ public void TestPop3CommandException () } } } + +#endif // NET6_0 diff --git a/UnitTests/Net/Proxy/ProxyProtocolExceptionTests.cs b/UnitTests/Net/Proxy/ProxyProtocolExceptionTests.cs index cb466bb4ab..9ddbf15e1f 100644 --- a/UnitTests/Net/Proxy/ProxyProtocolExceptionTests.cs +++ b/UnitTests/Net/Proxy/ProxyProtocolExceptionTests.cs @@ -24,6 +24,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MailKit.Net.Proxy; @@ -70,3 +72,5 @@ public void TestSerialization () } } } + +#endif // NET6_0 diff --git a/UnitTests/Net/Smtp/SmtpCommandExceptionTests.cs b/UnitTests/Net/Smtp/SmtpCommandExceptionTests.cs index 4502d33741..6aa193fbe1 100644 --- a/UnitTests/Net/Smtp/SmtpCommandExceptionTests.cs +++ b/UnitTests/Net/Smtp/SmtpCommandExceptionTests.cs @@ -24,6 +24,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MimeKit; @@ -66,3 +68,5 @@ public void TestSmtpCommandException () } } } + +#endif // NET6_0 diff --git a/UnitTests/Net/Smtp/SmtpProtocolExceptionTests.cs b/UnitTests/Net/Smtp/SmtpProtocolExceptionTests.cs index f17b947a28..51d38b2684 100644 --- a/UnitTests/Net/Smtp/SmtpProtocolExceptionTests.cs +++ b/UnitTests/Net/Smtp/SmtpProtocolExceptionTests.cs @@ -24,6 +24,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MailKit.Net.Smtp; @@ -70,3 +72,5 @@ public void TestSerialization () } } } + +#endif // NET6_0 diff --git a/UnitTests/Security/AuthenticationExceptionTests.cs b/UnitTests/Security/AuthenticationExceptionTests.cs index 7b38d2e8c1..40bbf783f6 100644 --- a/UnitTests/Security/AuthenticationExceptionTests.cs +++ b/UnitTests/Security/AuthenticationExceptionTests.cs @@ -24,6 +24,8 @@ // THE SOFTWARE. // +#if NET6_0 + using System.Runtime.Serialization.Formatters.Binary; using MailKit.Security; @@ -70,3 +72,5 @@ public void TestSerialization () } } } + +#endif // NET6_0 diff --git a/UnitTests/Security/SaslExceptionTests.cs b/UnitTests/Security/SaslExceptionTests.cs index 7ac7e440a3..0b4c39f3e0 100644 --- a/UnitTests/Security/SaslExceptionTests.cs +++ b/UnitTests/Security/SaslExceptionTests.cs @@ -38,6 +38,8 @@ public void TestArgumentExceptions () Assert.Throws (() => new SaslException (null, SaslErrorCode.MissingChallenge, "message")); } +#if NET6_0 + [Test] public void TestSerialization () { @@ -54,5 +56,6 @@ public void TestSerialization () Assert.AreEqual (expected.ErrorCode, ex.ErrorCode, "Unexpected ErrorCode."); } } +#endif // NET6_0 } } diff --git a/UnitTests/Security/SslHandshakeExceptionTests.cs b/UnitTests/Security/SslHandshakeExceptionTests.cs index 9c05a4e704..8a0faec954 100644 --- a/UnitTests/Security/SslHandshakeExceptionTests.cs +++ b/UnitTests/Security/SslHandshakeExceptionTests.cs @@ -41,6 +41,8 @@ public class SslHandshakeExceptionTests { const string HelpLink = "https://github.com/jstedfast/MailKit/blob/master/FAQ.md#ssl-handshake-exception"; +#if NET6_0 + [Test] public void TestSerialization () { @@ -144,6 +146,8 @@ public void TestSerialization () } } +#endif // NET6_0 + class FakeClient : MailService { SslCertificateValidationInfo sslValidationInfo;