diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.CloseHandle.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.CloseHandle.cs index ff41f939f1..f133f10156 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.CloseHandle.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.CloseHandle.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 !NET8_0_OR_GREATER + using System; using System.Runtime.InteropServices; @@ -13,3 +15,5 @@ internal partial class Kernel32 internal static extern bool CloseHandle(IntPtr handle); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/Interop.Libraries.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/Interop.Libraries.cs index c4f2f36493..7b74001a4f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/Interop.Libraries.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/Interop.Libraries.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 !NET8_0_OR_GREATER + internal static partial class Interop { internal static partial class Libraries @@ -10,3 +12,5 @@ internal static partial class Libraries internal const string NetSecurityNative = "System.Net.Security.Native"; } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs index b08b41aeb2..34bc0b18dd 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssApiException.cs @@ -2,9 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Data; +#if !NET8_0_OR_GREATER + using System; using System.Runtime.InteropServices; +using Microsoft.Data; internal static partial class Interop { @@ -56,3 +58,5 @@ private static string GetGssApiDisplayStatus(Status status, bool isMinor) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs index 0f479a8c62..112289bc7d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs @@ -2,10 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Data; +#if !NET8_0_OR_GREATER + using System; using System.Diagnostics; using System.Runtime.InteropServices; +using Microsoft.Data; internal static partial class Interop { @@ -74,3 +76,5 @@ static GssBuffer() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs index 489d1cf8a9..f5e7d18f24 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs @@ -2,8 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if !NET8_0_OR_GREATER + using System; -using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -126,3 +127,5 @@ static NetSecurityNative() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs index 2fb8e48a1d..6b8e616894 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates.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 !NET8_0_OR_GREATER + using System; using System.Runtime.InteropServices; @@ -24,3 +26,5 @@ internal static extern bool CertVerifyCertificateChainPolicy( [In, Out] ref CERT_CHAIN_POLICY_STATUS pPolicyStatus); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates_types.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates_types.cs index cbf5c3309e..c120f1ba71 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates_types.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Crypt32/Interop.certificates_types.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 !NET8_0_OR_GREATER + using System; using System.Runtime.InteropServices; @@ -125,3 +127,5 @@ internal unsafe struct CERT_CHAIN_POLICY_STATUS } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs index 435de74c59..dfd98621d6 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.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 !NET8_0_OR_GREATER + internal static partial class Interop { internal enum SECURITY_STATUS @@ -358,3 +360,5 @@ internal static string MapSecurityStatus(uint statusCode) } #endif // TRACE_VERBOSE } + +#endif // !NET8_OR_GREATER diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/SecPkgContext_ConnectionInfo.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/SecPkgContext_ConnectionInfo.cs index 57b6eb3405..762c3ea146 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/SecPkgContext_ConnectionInfo.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/SChannel/SecPkgContext_ConnectionInfo.cs @@ -2,7 +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. -using System.Diagnostics; +#if !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -45,3 +46,5 @@ internal unsafe SecPkgContext_ConnectionInfo(byte[] nativeBuffer) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/GlobalSSPI.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/GlobalSSPI.cs index 78571c5c96..6077ba5a77 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/GlobalSSPI.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/GlobalSSPI.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 !NET8_0_OR_GREATER + namespace System.Net { internal static class GlobalSSPI @@ -10,3 +12,5 @@ internal static class GlobalSSPI internal static readonly SSPIInterface SSPISecureChannel = new SSPISecureChannelType(); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/Interop.SSPI.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/Interop.SSPI.cs index 8ceed0e870..bb8d1ede6a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/Interop.SSPI.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/Interop.SSPI.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 !NET8_0_OR_GREATER + using System; using System.Net.Security; using System.Runtime.InteropServices; @@ -388,3 +390,5 @@ internal static extern unsafe SECURITY_STATUS SspiEncodeStringsAsAuthIdentity( [Out] out SafeSspiAuthDataHandle authData); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/NegotiationInfoClass.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/NegotiationInfoClass.cs index f5f7ab1b07..133c935174 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/NegotiationInfoClass.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/NegotiationInfoClass.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 !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -59,3 +61,5 @@ internal NegotiationInfoClass(SafeHandle safeHandle, int negotiationState) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs index cdb3819605..4a86701ffd 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIAuthType.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 !NET8_0_OR_GREATER + using System.Net.Security; using System.Runtime.InteropServices; using Microsoft.Data; @@ -199,3 +201,5 @@ public int ApplyControlToken(ref SafeDeleteContext refContext, SecurityBuffer[] } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIInterface.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIInterface.cs index 655dcec07a..22e9a3c93d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIInterface.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIInterface.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 !NET8_0_OR_GREATER + using System.Net.Security; using System.Runtime.InteropServices; @@ -30,3 +32,5 @@ internal interface SSPIInterface int ApplyControlToken(ref SafeDeleteContext refContext, SecurityBuffer[] inputBuffers); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs index 4152a89a7d..e6c213d241 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPISecureChannelType.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 !NET8_0_OR_GREATER + using System.Net.Security; using System.Runtime.InteropServices; using Microsoft.Data; @@ -155,3 +157,5 @@ public int ApplyControlToken(ref SafeDeleteContext refContext, SecurityBuffer[] } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs index f8231f9069..389cd83df3 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SSPIWrapper.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 !NET8_0_OR_GREATER + using System.ComponentModel; using System.Globalization; using System.Net.Security; @@ -595,3 +597,5 @@ public static string ErrorDescription(int errorCode) } } // class SSPIWrapper } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SafeDeleteContext.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SafeDeleteContext.cs index cc9f80164f..7701689286 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SafeDeleteContext.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SafeDeleteContext.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Win32.SafeHandles; +#if !NET8_0_OR_GREATER -using System.Diagnostics; using System.Runtime.InteropServices; -using System.Security.Authentication.ExtendedProtection; namespace System.Net.Security { @@ -53,3 +51,5 @@ public override string ToString() #endif } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Bindings.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Bindings.cs index eb31544de1..f5bbb448eb 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Bindings.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Bindings.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 !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -14,3 +16,5 @@ internal struct SecPkgContext_Bindings internal IntPtr Bindings; } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_NegotiationInfoW.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_NegotiationInfoW.cs index 4dc03b53a6..a5c71068eb 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_NegotiationInfoW.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_NegotiationInfoW.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 !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -14,3 +16,5 @@ internal struct SecPkgContext_NegotiationInfoW internal uint NegotiationState; } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Sizes.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Sizes.cs index 48cdd54d2a..17fce36c6d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Sizes.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_Sizes.cs @@ -2,7 +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. -using System.Diagnostics; +#if !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -40,3 +41,5 @@ internal unsafe SecPkgContext_Sizes(byte[] memory) public static readonly int SizeOf = Marshal.SizeOf(); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_StreamSizes.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_StreamSizes.cs index 519b607da7..98ec1a1d60 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_StreamSizes.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecPkgContext_StreamSizes.cs @@ -2,7 +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. -using System.Diagnostics; +#if !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -42,3 +43,5 @@ internal unsafe SecPkgContext_StreamSizes(byte[] memory) public static readonly int SizeOf = Marshal.SizeOf(); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfo.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfo.cs index 3ec3c7fda6..73e9c8635c 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfo.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfo.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 !NET8_0_OR_GREATER + using System.Runtime.InteropServices; namespace System.Net @@ -18,3 +20,5 @@ internal struct SecurityPackageInfo internal IntPtr Comment; } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfoClass.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfoClass.cs index 74fca62e89..433904171e 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfoClass.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecurityPackageInfoClass.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 !NET8_0_OR_GREATER + using System.Globalization; using System.Runtime.InteropServices; @@ -76,3 +78,5 @@ public override string ToString() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs index f78b10697d..428e0e39eb 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs @@ -2,12 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Win32.SafeHandles; +#if !NET8_0_OR_GREATER using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security.Authentication.ExtendedProtection; +using Microsoft.Win32.SafeHandles; namespace System.Net.Security { @@ -1279,3 +1280,5 @@ protected override bool ReleaseHandle() } } } + +#endif // !NET8_OR_GREATER diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs index 6921ef6aba..6a5a8b17c8 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.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 !NET8_0_OR_GREATER + using System; using System.Diagnostics; using System.Runtime.InteropServices; @@ -135,3 +137,5 @@ protected override bool ReleaseHandle() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Collections/Generic/BidirectionalDictionary.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Collections/Generic/BidirectionalDictionary.cs index 32c4463433..2bf8459e1b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Collections/Generic/BidirectionalDictionary.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Collections/Generic/BidirectionalDictionary.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 !NET8_0_OR_GREATER + using System.Diagnostics; namespace System.Collections.Generic @@ -59,3 +61,5 @@ IEnumerator IEnumerable.GetEnumerator() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Unix.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Unix.cs index 599bd4ab7d..148e0bb76d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Unix.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Unix.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. -using System; +#if !NET8_0_OR_GREATER namespace System.Net { @@ -84,3 +84,5 @@ internal static Interop.NetSecurityNative.GssFlags GetInteropFromContextFlagsPal } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Windows.cs index 5ed6e347d8..036f24d4ed 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsAdapterPal.Windows.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. -using System; +#if !NET8_0_OR_GREATER namespace System.Net { @@ -75,3 +75,5 @@ internal static Interop.SspiCli.ContextFlags GetInteropFromContextFlagsPal(Conte } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsPal.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsPal.cs index d4df40b597..f0df3bd677 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsPal.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/ContextFlagsPal.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. -using System; +#if !NET8_0_OR_GREATER namespace System.Net { @@ -33,3 +33,5 @@ internal enum ContextFlagsPal UnverifiedTargetName = 0x20000000, } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleMinusOneIsInvalid.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleMinusOneIsInvalid.cs index 1949341de2..a9d0965324 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleMinusOneIsInvalid.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleMinusOneIsInvalid.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if DEBUG && !NET8_0_OR_GREATER + using Microsoft.Win32.SafeHandles; namespace System.Net { -#if DEBUG // // This is a helper class for debugging GC-ed handles that we define. // As a general rule normal code path should always destroy handles explicitly @@ -38,5 +39,6 @@ private void Trace() NetEventSource.Info(this, _trace); } } -#endif // DEBUG } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleZeroOrMinusOneIsInvalid.cs index c28a7107b1..fcb485d568 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleZeroOrMinusOneIsInvalid.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugCriticalHandleZeroOrMinusOneIsInvalid.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if DEBUG && !NET8_0_OR_GREATER + using Microsoft.Win32.SafeHandles; namespace System.Net { -#if DEBUG // // This is a helper class for debugging GC-ed handles that we define. // As a general rule normal code path should always destroy handles explicitly @@ -38,5 +39,6 @@ private void Trace() NetEventSource.Info(this, _trace); } } -#endif // DEBUG } + +#endif // !NET8_0_OR_GREATER diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugSafeHandle.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugSafeHandle.cs index b0646f92e9..55d5bd8a6f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugSafeHandle.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/DebugSafeHandle.cs @@ -2,17 +2,17 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Win32.SafeHandles; +#if DEBUG && !NET8_0_OR_GREATER using System.Net.NetworkInformation; using System.Net.Sockets; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; +using Microsoft.Win32.SafeHandles; namespace System.Net { -#if DEBUG // // This is a helper class for debugging GC-ed handles that we define. // As a general rule normal code path should always destroy handles explicitly @@ -47,5 +47,6 @@ private void Trace() NetEventSource.Info(this, _trace); } } -#endif // DEBUG } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Logging/DebugThreadTracking.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Logging/DebugThreadTracking.cs index 78d8d48ac6..cd66ff2287 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Logging/DebugThreadTracking.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Logging/DebugThreadTracking.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 !NET8_0_OR_GREATER + using System.Collections.Generic; namespace System.Net @@ -162,3 +164,5 @@ internal enum ThreadKinds ThreadPool = CompletionPort | Worker, // Like Thread.CurrentThread.IsThreadPoolThread } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/NegotiationInfoClass.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/NegotiationInfoClass.cs index 560098ef4c..d931c7c70d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/NegotiationInfoClass.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/NegotiationInfoClass.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 !NET8_0_OR_GREATER + namespace System.Net { // This class is used to determine if NTLM or @@ -14,3 +16,5 @@ internal partial class NegotiationInfoClass internal const string Basic = "Basic"; } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Unix.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Unix.cs index 70c1a74377..f670a086cf 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Unix.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Unix.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 !NET8_0_OR_GREATER + using System.ComponentModel; using System.Diagnostics; using Microsoft.Win32.SafeHandles; @@ -246,3 +248,5 @@ internal static SafeFreeCredentials AcquireCredentialsHandle(string package, boo } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Windows.cs index fe56d8ed91..2ce87ac951 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NegotiateStreamPal.Windows.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 !NET8_0_OR_GREATER + using System.Globalization; using System.ComponentModel; using Microsoft.Data; @@ -215,3 +217,5 @@ internal static int MakeSignature(SafeDeleteContext securityContext, byte[] buff } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.Windows.cs index f229b6845a..e28cc18296 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.Windows.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 !NET8_0_OR_GREATER + using System.Diagnostics.Tracing; using System.Net.Security; @@ -88,3 +90,5 @@ public void SecurityContextInputBuffers(string context, int inputBuffersSize, in } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.cs index b003ce8b7e..e785fe016d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/NetEventSource.Security.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if !NET8_0_OR_GREATER + using System.Diagnostics.Tracing; -using System.Globalization; -using System.Net.Security; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; namespace System.Net { @@ -34,3 +32,5 @@ public void SspiPackageNotFound(string packageName) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBuffer.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBuffer.cs index b507449f1e..54c060a6e1 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBuffer.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBuffer.cs @@ -2,7 +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. -using System.Diagnostics; +#if !NET8_0_OR_GREATER + using System.Runtime.InteropServices; using System.Security.Authentication.ExtendedProtection; @@ -61,3 +62,5 @@ public SecurityBuffer(ChannelBinding binding) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBufferType.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBufferType.cs index 51174938a1..ca29feac84 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBufferType.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityBufferType.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 !NET8_0_OR_GREATER + namespace System.Net.Security { // sspi.h @@ -26,3 +28,5 @@ internal enum SecurityBufferType SECBUFFER_READONLY_WITH_CHECKSUM = 0x10000000 } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityContextTokenHandle.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityContextTokenHandle.cs index 00e5b3ac60..3d146e5bcc 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityContextTokenHandle.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/SecurityContextTokenHandle.cs @@ -2,9 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Win32.SafeHandles; +#if !NET8_0_OR_GREATER using System.Threading; +using Microsoft.Win32.SafeHandles; namespace System.Net.Security { @@ -39,3 +40,5 @@ protected override bool ReleaseHandle() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteContext.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteContext.cs index c3c75790b9..16636afd29 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteContext.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteContext.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 !NET8_0_OR_GREATER + using System.Diagnostics; using System.Runtime.InteropServices; @@ -44,3 +46,5 @@ protected override bool ReleaseHandle() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteNegoContext.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteNegoContext.cs index b98e9ac80b..53fe8e5ad9 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteNegoContext.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeDeleteNegoContext.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 !NET8_0_OR_GREATER + using System.Diagnostics; using Microsoft.Win32.SafeHandles; @@ -75,3 +77,5 @@ protected override void Dispose(bool disposing) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeCredentials.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeCredentials.cs index 51d6869a8d..254d9d127a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeCredentials.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeCredentials.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 !NET8_0_OR_GREATER + using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -71,3 +73,5 @@ protected override bool ReleaseHandle() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeNegoCredentials.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeNegoCredentials.cs index 217c787619..19ad2e2451 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeNegoCredentials.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/Security/Unix/SafeFreeNegoCredentials.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 !NET8_0_OR_GREATER + using System.Diagnostics; using Microsoft.Win32.SafeHandles; @@ -84,3 +86,5 @@ protected override bool ReleaseHandle() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs index b7ce1e6b1e..c3b13d549f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusAdapterPal.Windows.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 !NET8_0_OR_GREATER + using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -101,3 +103,5 @@ internal static Interop.SECURITY_STATUS GetInteropFromSecurityStatusPal(Security } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusPal.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusPal.cs index 54b380e74f..5bbe78bd00 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusPal.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/System/Net/SecurityStatusPal.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 !NET8_0_OR_GREATER + namespace System.Net { internal readonly struct SecurityStatusPal @@ -71,3 +73,5 @@ internal enum SecurityStatusPalErrorCode ApplicationProtocolMismatch } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index f2827967b1..122fcaa089 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -30,6 +30,49 @@ + + Common\CoreLib\System\Threading\Tasks\TaskToApm.cs + + + Common\Microsoft\Data\ProviderBase\DbConnectionClosed.cs + + + Common\Microsoft\Data\ProviderBase\DbConnectionFactory.cs + + + Common\Microsoft\Data\ProviderBase\DbConnectionInternal.cs + + + Common\System\Net\ContextFlagsPal.cs + + + Common\System\Net\DebugCriticalHandleMinusOneIsInvalid.cs + + + Common\System\Net\DebugSafeHandle.cs + + + Common\System\Net\InternalException.cs + + + Common\System\Net\Logging\DebugThreadTracking.cs + + + Common\System\Net\Logging\NetEventSource.Common.cs + + + Common\System\Net\NegotiationInfoClass.cs + + + Common\System\Net\Security\SecurityBuffer.cs + + + Common\System\Net\Security\SecurityBufferType.cs + + + Common\System\Net\SecurityStatusPal.cs + + Microsoft\Data\Common\ActivityCorrelator.cs @@ -81,6 +124,9 @@ Microsoft\Data\ProviderBase\DbMetaDataFactory.cs + + Common\Microsoft\Data\ProviderBase\DbReferenceCollection.cs + Microsoft\Data\ProviderBase\FieldNameLookup.cs @@ -105,12 +151,18 @@ Microsoft\Data\SqlClient\ActiveDirectoryAuthenticationTimeoutRetryHelper.cs + + Microsoft\Data\SqlClient\AlwaysEncryptedEnclaveProviderUtils.cs + Microsoft\Data\SqlClient\ApplicationIntent.cs Microsoft\Data\SqlClient\AssemblyRef.cs + + Microsoft\Data\SqlClient\AzureAttestationBasedEnclaveProvider.cs + Microsoft\Data\SqlClient\ColumnEncryptionKeyInfo.cs @@ -123,12 +175,27 @@ Microsoft\Data\SqlClient\EnclaveDelegate.cs + + Microsoft\Data\SqlClient\EnclaveDelegate.Crypto.cs + + + Microsoft\Data\SqlClient\EnclaveDelegate.NotSupported.cs + Microsoft\Data\SqlClient\EnclavePackage.cs + + Microsoft\Data\SqlClient\EnclaveProviderBase.cs + + + Microsoft\Data\SqlClient\EnclaveSessionCache.cs + Microsoft\Data\SqlClient\LocalAppContextSwitches.cs + + Microsoft\Data\SqlClient\NoneAttestationEnclaveProvider.cs + Microsoft\Data\SqlClient\OnChangedEventHandler.cs @@ -177,9 +244,6 @@ Microsoft\Data\SqlClient\RowsCopiedEventHandler.cs - - Microsoft\Data\SqlClient\SqlSequentialTextReader.cs - Microsoft\Data\SqlClient\Server\ExtendedClrTypeCode.cs @@ -246,8 +310,8 @@ Microsoft\Data\SqlClient\Server\SqlRecordBuffer.cs - - Microsoft\Data\SqlClient\SqlTransaction.Common.cs + + Microsoft\Data\SqlClient\Server\SqlSer.cs Microsoft\Data\SqlClient\Server\ValueUtilsSmi.cs @@ -273,9 +337,6 @@ Microsoft\Data\SqlClient\SqlAuthenticationProvider.cs - - Microsoft\Data\SqlClient\SqlBuffer.cs - Microsoft\Data\SqlClient\SqlAuthenticationToken.cs @@ -285,9 +346,15 @@ Microsoft\Data\SqlClient\SqlBatchCommand.cs + + Microsoft\Data\SqlClient\SqlBatchCommand.Net8OrGreater.cs + Microsoft\Data\SqlClient\SqlBatchCommandCollection.cs + + Microsoft\Data\SqlClient\SqlBuffer.cs + Microsoft\Data\SqlClient\SqlBulkCopyColumnMapping.cs @@ -333,12 +400,12 @@ Microsoft\Data\SqlClient\SqlCollation.cs - - Microsoft\Data\SqlClient\SqlColumnEncryptionKeyStoreProvider.cs - Microsoft\Data\SqlClient\SqlCommandBuilder.cs + + Microsoft\Data\SqlClient\SqlColumnEncryptionKeyStoreProvider.cs + Microsoft\Data\SqlClient\SqlCommandSet.cs @@ -384,6 +451,15 @@ Microsoft\Data\SqlClient\SqlDependencyUtils.AppDomain.cs + + Microsoft\Data\SqlClient\SqlDependencyUtils.AssemblyLoadContext.cs + + + Microsoft\Data\SqlClient\SqlEnclaveAttestationParameters.Crypto.cs + + + Microsoft\Data\SqlClient\SqlEnclaveAttestationParameters.NotSupported.cs + Microsoft\Data\SqlClient\SqlEnclaveSession.cs @@ -465,12 +541,15 @@ Microsoft\Data\SqlClient\SqlSequentialStream.cs - - Microsoft\Data\SqlClient\Server\SqlSer.cs + + Microsoft\Data\SqlClient\SqlSequentialTextReader.cs Microsoft\Data\SqlClient\SqlStatistics.cs + + Microsoft\Data\SqlClient\SqlStream.cs + Microsoft\Data\SqlClient\SqlSymmetricKeyCache.cs @@ -480,12 +559,27 @@ Microsoft\Data\SqlClient\SqlUtil.cs + + Microsoft\Data\SqlClient\SqlTransaction.Common.cs + + + Microsoft\Data\SqlClient\SSPI\ManagedSSPIContextProvider.cs + + + Microsoft\Data\SqlClient\SSPI\NegotiateSSPIContextProvider.cs + + + Microsoft\Data\SqlClient\SSPI\SSPIContextProvider.cs + Microsoft\Data\SqlClient\TdsEnums.cs Microsoft\Data\SqlClient\TdsParameterSetter.cs + + Microsoft\Data\SqlClient\TdsParser.cs + Microsoft\Data\SqlClient\TdsParserStateObject.cs @@ -501,16 +595,19 @@ Microsoft\Data\SqlClient\TdsValueSetter.cs + + Microsoft\Data\SqlClient\VirtualSecureModeEnclaveProvider.cs + + + Microsoft\Data\SqlClient\VirtualSecureModeEnclaveProviderBase.cs + Microsoft\Data\SQLTypes\SQLResource.cs Microsoft\Data\SqlTypes\SqlTypeWorkarounds.cs - - Microsoft\Data\SqlClient\SqlStream.cs - - + Resources\ResCategoryAttribute.cs @@ -519,132 +616,23 @@ Common\System\Diagnostics\CodeAnalysis.cs - - Microsoft\Data\SqlClient\SSPI\ManagedSSPIContextProvider.cs - - - Microsoft\Data\SqlClient\SSPI\NegotiateSSPIContextProvider.cs - - - Microsoft\Data\SqlClient\SSPI\SSPIContextProvider.cs - - - Microsoft\Data\SqlClient\TdsParser.cs - - - Microsoft\Data\ProviderBase\DbReferenceCollection.cs - - - - - - - - Microsoft\Data\SqlClient\EnclaveDelegate.NotSupported.cs - - - Microsoft\Data\SqlClient\SqlEnclaveAttestationParameters.NotSupported.cs - - - - - - - - - - - - Microsoft\Data\SqlClient\AlwaysEncryptedEnclaveProviderUtils.cs - - - Microsoft\Data\SqlClient\AzureAttestationBasedEnclaveProvider.cs - - - Microsoft\Data\SqlClient\EnclaveDelegate.Crypto.cs - - - Microsoft\Data\SqlClient\EnclaveProviderBase.cs - - - Microsoft\Data\SqlClient\EnclaveSessionCache.cs - - - Microsoft\Data\SqlClient\SqlEnclaveAttestationParameters.Crypto.cs - - - Microsoft\Data\SqlClient\VirtualSecureModeEnclaveProvider.cs - - - Microsoft\Data\SqlClient\NoneAttestationEnclaveProvider.cs - - - Microsoft\Data\SqlClient\VirtualSecureModeEnclaveProviderBase.cs - - - - - - - - - - - - - Microsoft\Data\SqlClient\SqlDependencyUtils.AssemblyLoadContext.cs - - - - - - - Resources\StringsHelper.cs - - - Resources\Strings.Designer.cs - True - True - Strings.resx - - - Resources\Strings.resx - Microsoft.Data.SqlClient.Resources.Strings.resources - ResXFileCodeGenerator - Strings.Designer.cs - System - - - Resources\%(RecursiveDir)%(Filename)%(Extension) - - - - - Common\CoreLib\System\Threading\Tasks\TaskToApm.cs - - - Common\Microsoft\Data\ProviderBase\DbConnectionClosed.cs - - - Common\Microsoft\Data\ProviderBase\DbConnectionFactory.cs - - - Common\Microsoft\Data\ProviderBase\DbConnectionInternal.cs - - + + + + @@ -654,16 +642,26 @@ + + - + + + + + + + + + @@ -671,68 +669,55 @@ + + + + - - - + + - - Microsoft\Data\Common\AdapterUtil.Windows.cs - - - Microsoft\Data\Sql\SqlDataSourceEnumeratorNativeHelper.cs - - - Microsoft\Data\Sql\SqlDataSourceEnumerator.Windows.cs - - - - - - Microsoft\Data\SqlClient\TdsParserSafeHandles.Windows.cs - - - - - - Microsoft\Data\Common\AdapterUtil.Unix.cs - - - - - - - - - - - - - Common\CoreLib\Interop\Windows\kernel32\Interop.FileTypes.cs + + Common\CoreLib\Interop\Windows\kernel32\Interop.FileTypes.cs Common\CoreLib\Interop\Windows\kernel32\Interop.GetFileType_SafeHandle.cs + + Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs + Common\CoreLib\Interop\Windows\kernel32\Interop.SetThreadErrorMode.cs + + Common\CoreLib\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs + Common\CoreLib\System\IO\PathInternal.Windows.cs + + Common\Interop\Windows\Crypt32\Interop.certificates.cs + + + Common\Interop\Windows\Crypt32\Interop.certificates_types.cs + Common\Interop\Windows\Interop.Errors.cs + + Common\Interop\Windows\Interop.Libraries.cs + Common\Interop\Windows\Interop.UNICODE_STRING.cs @@ -742,6 +727,12 @@ Common\Interop\Windows\Kernel32\Interop.DeviceIoControl.cs + + Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs + + + Common\Interop\Windows\kernel32\Interop.GetProcAddress.cs + Common\Interop\Windows\Kernel32\Interop.IoControlCodeAccess.cs @@ -760,89 +751,6 @@ Common\Interop\Windows\NtDll\Interop.RtlNtStatusToDosError.cs - - - - - - - - - - - - - - - - - - - - - - Common\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs - - - Microsoft\Data\SqlClient\SSPI\NativeSSPIContextProvider.cs - - - - - - - - - - - Common\CoreLib\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs - - - Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs - - - Common\Interop\Windows\kernel32\Interop.GetProcAddress.cs - - - - - - - Common\Interop\Windows\Interop.Libraries.cs - - - - - - Common\System\Net\InternalException.cs - - - Common\System\Net\Logging\NetEventSource.Common.cs - - - - - - - - - - - - - - - - - - Common\CoreLib\Interop\Windows\Kernel32\Interop.CloseHandle.cs - - - Common\Interop\Windows\Crypt32\Interop.certificates.cs - - - Common\Interop\Windows\Crypt32\Interop.certificates_types.cs - Common\Interop\Windows\SChannel\Interop.SecPkgContext_ApplicationProtocol.cs @@ -852,30 +760,6 @@ Common\Interop\Windows\SChannel\SecPkgContext_ConnectionInfo.cs - - Common\System\Collections\Generic\BidirectionalDictionary.cs - - - Common\System\Net\ContextFlagsAdapterPal.Windows.cs - - - Common\System\Net\DebugCriticalHandleZeroOrMinusOneIsInvalid.cs - - - Common\System\Net\Security\SecurityContextTokenHandle.cs - - - Common\System\Net\SecurityStatusAdapterPal.Windows.cs - - - Common\System\Net\Security\NegotiateStreamPal.Windows.cs - - - Common\System\Net\Security\NetEventSource.Security.cs - - - Common\System\Net\Security\NetEventSource.Security.Windows.cs - Common\Interop\Windows\sspicli\GlobalSSPI.cs @@ -921,37 +805,56 @@ Common\Interop\Windows\sspicli\SSPIWrapper.cs - - - - - Common\System\Net\ContextFlagsPal.cs + + Common\System\Collections\Generic\BidirectionalDictionary.cs - - Common\System\Net\DebugCriticalHandleMinusOneIsInvalid.cs + + Common\System\Net\ContextFlagsAdapterPal.Windows.cs - - Common\System\Net\DebugSafeHandle.cs + + Common\System\Net\DebugCriticalHandleZeroOrMinusOneIsInvalid.cs - - Common\System\Net\Logging\DebugThreadTracking.cs + + Common\System\Net\Security\NegotiateStreamPal.Windows.cs - - Common\System\Net\NegotiationInfoClass.cs + + Common\System\Net\Security\NetEventSource.Security.cs - - Common\System\Net\Security\SecurityBuffer.cs + + Common\System\Net\Security\NetEventSource.Security.Windows.cs - - Common\System\Net\Security\SecurityBufferType.cs + + Common\System\Net\Security\SecurityContextTokenHandle.cs - - Common\System\Net\SecurityStatusPal.cs + + Common\System\Net\SecurityStatusAdapterPal.Windows.cs - + + + Microsoft\Data\Common\AdapterUtil.Windows.cs + + + Microsoft\Data\Sql\SqlDataSourceEnumeratorNativeHelper.cs + + + Microsoft\Data\Sql\SqlDataSourceEnumerator.Windows.cs + + + Microsoft\Data\SqlClient\TdsParserSafeHandles.Windows.cs + + + + + + + + + + - - + + + Common\Interop\Unix\Interop.Libraries.cs @@ -985,24 +888,82 @@ Common\System\Net\Security\NegotiateStreamPal.Unix.cs + + + Microsoft\Data\Common\AdapterUtil.Unix.cs + + + + + + + + + + + + + + + - - + + + + + + + + - - - Microsoft\Data\SqlClient\SqlBatchCommand.Net8OrGreater.cs + + + + + Common\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs + + Microsoft\Data\SqlClient\SSPI\NativeSSPIContextProvider.cs + + + + + + + - - - - + + + + Resources\StringsHelper.cs + + + Resources\Strings.Designer.cs + True + True + Strings.resx + + + Resources\Strings.resx + Microsoft.Data.SqlClient.Resources.Strings.resources + ResXFileCodeGenerator + Strings.Designer.cs + System + + + Resources\%(RecursiveDir)%(Filename)%(Extension) + Microsoft.Data.SqlClient.SqlMetaData.xml + + + + + + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.NetCoreApp.cs index c85d042b2a..9f330c3dcc 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionPool.NetCoreApp.cs @@ -2,14 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; +#if NETCOREAPP + using System.Diagnostics; using Microsoft.Data.Common; using Microsoft.Data.SqlClient; namespace Microsoft.Data.ProviderBase { - sealed internal partial class DbConnectionPool + internal sealed partial class DbConnectionPool { private bool IsBlockingPeriodEnabled() { @@ -44,3 +45,5 @@ private bool IsBlockingPeriodEnabled() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/AlwaysEncryptedKeyConverter.CrossPlatform.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/AlwaysEncryptedKeyConverter.CrossPlatform.cs index 8b3def875c..81b90debeb 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/AlwaysEncryptedKeyConverter.CrossPlatform.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/AlwaysEncryptedKeyConverter.CrossPlatform.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 !NETSTANDARD2_0 + using System; using System.Diagnostics; using System.Security.Cryptography; @@ -133,3 +135,5 @@ internal static RSA GetRSAFromCertificate(X509Certificate2 certificate) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.Task.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.Task.cs index a1bf4a9e0e..399c43cb9b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.Task.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.Task.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 NETSTANDARD2_0 + using System.Threading; using System.Threading.Tasks; @@ -91,3 +93,5 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.ValueTask.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.ValueTask.cs index f5f38f0efe..03b071eac2 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.ValueTask.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.ValueTask.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 !NETSTANDARD2_0 + using System.Threading; using System.Threading.Tasks; using System; @@ -107,3 +109,5 @@ public override async ValueTask WriteAsync(ReadOnlyMemory buffer, Cancella } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetCoreApp.cs index be8d1a0160..655fc91d7c 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetCoreApp.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 !NETSTANDARD2_0 + using System; using System.Buffers; using System.Threading; @@ -293,3 +295,5 @@ public override async ValueTask WriteAsync(ReadOnlyMemory buffer, Cancella } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetStandard.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetStandard.cs index 60bb597974..e411c2955e 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetStandard.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SslOverTdsStream.NetStandard.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 NETSTANDARD2_0 + using System; using System.Buffers; using System.IO; @@ -221,3 +223,5 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SspiClientContextStatus.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SspiClientContextStatus.cs index b557bfa0be..d9aabab16b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SspiClientContextStatus.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SspiClientContextStatus.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 !NET8_0_OR_GREATER + using System.Net; using System.Net.Security; @@ -28,3 +30,5 @@ public ContextFlagsPal ContextFlags } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetCoreApp.cs index dd57c60da8..9170614927 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetCoreApp.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 !NETSTANDARD2_0 + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -195,3 +197,5 @@ internal class SqlClientAuthenticationProviderConfigurationSection : SqlAuthenti } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetStandard.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetStandard.cs index 01a84342f8..0fa64d0cef 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetStandard.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetStandard.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 NETSTANDARD2_0 + namespace Microsoft.Data.SqlClient { internal partial class SqlAuthenticationProviderManager @@ -13,3 +15,5 @@ static SqlAuthenticationProviderManager() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientEventSource.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientEventSource.NetCoreApp.cs index c0312ca219..6dc531f766 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientEventSource.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientEventSource.NetCoreApp.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 !NETSTANDARD2_0 + using System; using System.Diagnostics.Tracing; using System.Threading; @@ -394,3 +396,5 @@ internal override void ReclaimedConnectionRequest() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientFactory.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientFactory.NetCoreApp.cs index 4b0d4a8b2d..a48179b621 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientFactory.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlClientFactory.NetCoreApp.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 NET6_0_OR_GREATER + using System.Data.Common; namespace Microsoft.Data.SqlClient @@ -18,3 +20,5 @@ public sealed partial class SqlClientFactory : DbProviderFactory public override DbBatchCommand CreateBatchCommand() => new SqlBatchCommand(); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs index fd81db557d..da5a516004 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.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 !NETSTANDARD2_0 + using System.Security.Cryptography; namespace Microsoft.Data.SqlClient @@ -23,3 +25,5 @@ internal abstract void CreateEnclaveSession(byte[] enclaveAttestationInfo, ECDif out SqlEnclaveSession sqlEnclaveSession, out long counter); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionFactory.AssemblyLoadContext.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionFactory.AssemblyLoadContext.cs index 7338b8d4d2..38411594af 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionFactory.AssemblyLoadContext.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnectionFactory.AssemblyLoadContext.cs @@ -2,13 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETCOREAPP + using System; using System.Reflection; using System.Runtime.Loader; namespace Microsoft.Data.SqlClient { - sealed internal partial class SqlConnectionFactory + internal sealed partial class SqlConnectionFactory { partial void SubscribeToAssemblyLoadContextUnload() { @@ -21,3 +23,5 @@ private void SqlConnectionFactoryAssemblyLoadContext_Unloading(AssemblyLoadConte } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetCoreApp.cs index c4655c4355..ea27ceabe0 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetCoreApp.cs @@ -2,15 +2,19 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if !NETSTANDARD2_0 + using System; using System.Transactions; namespace Microsoft.Data.SqlClient { - sealed internal partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification + internal sealed partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification { // Get the server-side Global Transaction Id from the PromotedDTCToken // Skip first 4 bytes since they contain the version private Guid GetGlobalTxnIdentifierFromToken() => new Guid(new ReadOnlySpan(_connection.PromotedDTCToken, _globalTransactionsTokenVersionSizeInBytes, 16)); } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetStandard.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetStandard.cs index cb97c4d677..ba50ca5d14 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetStandard.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDelegatedTransaction.NetStandard.cs @@ -2,12 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD2_0 + using System; using System.Transactions; namespace Microsoft.Data.SqlClient { - sealed internal partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification + internal sealed partial class SqlDelegatedTransaction : IPromotableSinglePhaseNotification { // Get the server-side Global Transaction Id from the PromotedDTCToken // Skip first 4 bytes since they contain the version @@ -20,3 +22,5 @@ private Guid GetGlobalTxnIdentifierFromToken() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetCoreApp.cs index 95dd0d9731..2c7554a0cb 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetCoreApp.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetCoreApp.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 !NETSTANDARD2_0 + using System; using System.Diagnostics; using System.Buffers.Binary; @@ -23,3 +25,5 @@ internal static Guid ConstructGuid(ReadOnlySpan bytes) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetStandard.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetStandard.cs index 72c0b77b19..2327f92b72 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetStandard.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.NetStandard.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 NETSTANDARD2_0 + using System; using System.Buffers; using System.Diagnostics; @@ -39,3 +41,5 @@ internal static Guid ConstructGuid(ReadOnlySpan bytes) } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AlwaysEncryptedEnclaveProviderUtils.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AlwaysEncryptedEnclaveProviderUtils.cs index ff84ab3310..890af0206f 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AlwaysEncryptedEnclaveProviderUtils.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AlwaysEncryptedEnclaveProviderUtils.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 !NETSTANDARD2_0 + using System; namespace Microsoft.Data.SqlClient @@ -49,3 +51,5 @@ internal enum EnclaveType Sgx = 2 } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AzureAttestationBasedEnclaveProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AzureAttestationBasedEnclaveProvider.cs index 7b1b2bf2e4..70f6bc5f91 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AzureAttestationBasedEnclaveProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/AzureAttestationBasedEnclaveProvider.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 !NETSTANDARD2_0 + using System; using System.Collections.Generic; using System.Diagnostics; @@ -540,3 +542,5 @@ private byte[] GetSharedSecret(EnclavePublicKey enclavePublicKey, byte[] nonce, #endregion } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.Crypto.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.Crypto.cs index db1bdea90f..fc87127b04 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.Crypto.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.Crypto.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 !NETSTANDARD2_0 + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -211,3 +213,5 @@ internal byte[] GetSerializedAttestationParameters(SqlEnclaveAttestationParamete } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.NotSupported.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.NotSupported.cs index 461bfdf6d7..3c3afac335 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.NotSupported.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveDelegate.NotSupported.cs @@ -2,9 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if NETSTANDARD2_0 + using System; using System.Collections.Concurrent; -using System.Collections.Generic; namespace Microsoft.Data.SqlClient { @@ -54,3 +55,5 @@ internal SqlEnclaveAttestationParameters GetAttestationParameters(SqlConnectionA } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveProviderBase.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveProviderBase.cs index b8a52b9e4b..1a2bcaeb03 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveProviderBase.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveProviderBase.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 !NETSTANDARD2_0 + using System; using System.Runtime.Caching; using System.Security.Cryptography; @@ -213,3 +215,5 @@ protected SqlEnclaveSession AddEnclaveSessionToCache(EnclaveSessionParameters en } #endregion } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveSessionCache.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveSessionCache.cs index f76191fec8..d60c3ad5ba 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveSessionCache.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/EnclaveSessionCache.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 !NETSTANDARD2_0 + using System; using System.Runtime.Caching; using System.Threading; @@ -12,7 +14,7 @@ namespace Microsoft.Data.SqlClient internal class EnclaveSessionCache { private readonly MemoryCache enclaveMemoryCache = new MemoryCache("EnclaveMemoryCache"); - private readonly Object enclaveCacheLock = new Object(); + private readonly object enclaveCacheLock = new object(); // Nonce for each message sent by the client to the server to prevent replay attacks by the server, // given that for Always Encrypted scenarios, the server is considered an "untrusted" man-in-the-middle. @@ -37,8 +39,7 @@ internal void InvalidateSession(EnclaveSessionParameters enclaveSessionParameter lock (enclaveCacheLock) { - long counter; - SqlEnclaveSession enclaveSession = GetEnclaveSession(enclaveSessionParameters, out counter); + SqlEnclaveSession enclaveSession = GetEnclaveSession(enclaveSessionParameters, out _); if (enclaveSession != null && enclaveSession.SessionId == enclaveSessionToInvalidate.SessionId) { @@ -73,3 +74,5 @@ private string GenerateCacheKey(EnclaveSessionParameters enclaveSessionParameter } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/NoneAttestationEnclaveProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/NoneAttestationEnclaveProvider.cs index fabd69c976..9ef8a77d19 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/NoneAttestationEnclaveProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/NoneAttestationEnclaveProvider.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 !NETSTANDARD2_0 + using System; using System.Diagnostics; using System.Security.Cryptography; @@ -104,3 +106,5 @@ internal override void InvalidateEnclaveSession(EnclaveSessionParameters enclave } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatchCommand.Net8OrGreater.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatchCommand.Net8OrGreater.cs index d31480afc7..d81a378ecf 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatchCommand.Net8OrGreater.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatchCommand.Net8OrGreater.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 NET8_0_OR_GREATER + using System.Data.Common; namespace Microsoft.Data.SqlClient @@ -15,3 +17,5 @@ public partial class SqlBatchCommand public override bool CanCreateParameter => true; } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyUtils.AssemblyLoadContext.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyUtils.AssemblyLoadContext.cs index 47f62fc5ac..c3f82f0047 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyUtils.AssemblyLoadContext.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDependencyUtils.AssemblyLoadContext.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 NETCOREAPP + using System; using System.Reflection; using System.Runtime.Loader; @@ -24,3 +26,5 @@ private void SqlDependencyPerAppDomainDispatcher_Unloading(AssemblyLoadContext o } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.Crypto.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.Crypto.cs index c2e9739237..2abb408d41 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.Crypto.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.Crypto.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 !NETSTANDARD2_0 + using System; using System.Security.Cryptography; @@ -50,3 +52,5 @@ internal byte[] GetInput() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.NotSupported.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.NotSupported.cs index 0ae67d4a94..64d5d19655 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.NotSupported.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlEnclaveAttestationParameters.NotSupported.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 NETSTANDARD2_0 + namespace Microsoft.Data.SqlClient { /// @@ -17,3 +19,5 @@ internal byte[] GetInput() } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProvider.cs index fd180d12d6..7ebad456f5 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProvider.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 !NETSTANDARD2_0 + using System; using System.Collections.Generic; using System.Diagnostics; @@ -468,3 +470,5 @@ public static byte[] TakeBytesAndAdvance(byte[] input, ref int offset, int count } } } + +#endif diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProviderBase.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProviderBase.cs index cfbe531e82..c60dd01c72 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProviderBase.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProviderBase.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 !NETSTANDARD2_0 + using System; using System.Runtime.Caching; using System.Security.Cryptography; @@ -419,3 +421,5 @@ private byte[] GetSharedSecret(EnclavePublicKey enclavePublicKey, EnclaveDiffieH #endregion } } + +#endif