diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/InternalException.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/InternalException.cs index 6e5a64cc65..db7d05d9a6 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/InternalException.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/InternalException.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NET && !NET8_0_OR_GREATER + namespace System.Net { [Serializable] @@ -21,3 +23,5 @@ public InternalException(string message, Exception innerException) : base(messag } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/Logging/NetEventSource.Common.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/Logging/NetEventSource.Common.cs index 1e56818132..c035159e20 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/Logging/NetEventSource.Common.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/Logging/NetEventSource.Common.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NET && !NET8_0_OR_GREATER + #if DEBUG // Uncomment to enable runtime checks to help validate that NetEventSource isn't being misused // in a way that will cause performance problems, e.g. unexpected boxing of value types. @@ -771,3 +773,5 @@ private unsafe void WriteEvent(int eventId, string arg1, string arg2, string arg #endregion } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/SChannel/Interop.SecPkgContext_ApplicationProtocol.netcore.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/SChannel/Interop.SecPkgContext_ApplicationProtocol.netcore.cs index 8c7537ac78..cd485ef450 100644 --- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/SChannel/Interop.SecPkgContext_ApplicationProtocol.netcore.cs +++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/SChannel/Interop.SecPkgContext_ApplicationProtocol.netcore.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NET +#if NET && !NET8_0_OR_GREATER using System; using System.Runtime.InteropServices;