diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
index 104b9261e7..e28e9c447c 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -149,15 +149,6 @@
Interop\Windows\NtDll\SecurityQualityOfService.cs
-
- Interop\Windows\Secur32\CredHandle.netfx.cs
-
-
- Interop\Windows\Secur32\ContextAttribute.netfx.cs
-
-
- Interop\Windows\Secur32\Secur32.netfx.cs
-
Interop\Windows\Sni\AuthProviderInfo.cs
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs
index 156d16dbd1..45fe78f630 100644
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs
+++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs
@@ -21,19 +21,10 @@ internal static class Kernel32Safe
{
private const string Kernel32 = "kernel32.dll";
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getcomputernameex.asp
- [DllImport(Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameExW", SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
- internal static extern int GetComputerNameEx(int nameType, StringBuilder nameBuffer, ref int bufferSize);
-
[DllImport(Kernel32, CharSet = CharSet.Auto)]
[ResourceExposure(ResourceScope.Process)]
internal static extern int GetCurrentProcessId();
- [DllImport(Kernel32, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
- [ResourceExposure(ResourceScope.Process)]
- internal static extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr), In] string moduleName);
-
[DllImport(Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true, SetLastError = true)]
[ResourceExposure(ResourceScope.None)]
internal static extern IntPtr GetProcAddress(IntPtr HModule, [MarshalAs(UnmanagedType.LPStr), In] string funcName);
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/ContextAttribute.netfx.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/ContextAttribute.netfx.cs
deleted file mode 100644
index 7b1c3f6372..0000000000
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/ContextAttribute.netfx.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace Interop.Windows.Secur32
-{
- internal enum ContextAttribute
- {
- // sspi.h
- SECPKG_ATTR_SIZES = 0,
- SECPKG_ATTR_NAMES = 1,
- SECPKG_ATTR_LIFESPAN = 2,
- SECPKG_ATTR_DCE_INFO = 3,
- SECPKG_ATTR_STREAM_SIZES = 4,
- SECPKG_ATTR_AUTHORITY = 6,
- SECPKG_ATTR_PACKAGE_INFO = 10,
- SECPKG_ATTR_NEGOTIATION_INFO = 12,
- SECPKG_ATTR_UNIQUE_BINDINGS = 25,
- SECPKG_ATTR_ENDPOINT_BINDINGS = 26,
- SECPKG_ATTR_CLIENT_SPECIFIED_TARGET = 27,
- SECPKG_ATTR_APPLICATION_PROTOCOL = 35,
-
- // minschannel.h
- SECPKG_ATTR_REMOTE_CERT_CONTEXT = 0x53, // returns PCCERT_CONTEXT
- SECPKG_ATTR_LOCAL_CERT_CONTEXT = 0x54, // returns PCCERT_CONTEXT
- SECPKG_ATTR_ROOT_STORE = 0x55, // returns HCERTCONTEXT to the root store
- SECPKG_ATTR_ISSUER_LIST_EX = 0x59, // returns SecPkgContext_IssuerListInfoEx
- SECPKG_ATTR_CONNECTION_INFO = 0x5A, // returns SecPkgContext_ConnectionInfo
- SECPKG_ATTR_UI_INFO = 0x68, // sets SEcPkgContext_UiInfo
- }
-}
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/CredHandle.netfx.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/CredHandle.netfx.cs
deleted file mode 100644
index c410674bc2..0000000000
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/CredHandle.netfx.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if NETFRAMEWORK
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Interop.Windows.Secur32
-{
- [StructLayout(LayoutKind.Sequential)]
- internal struct CredHandle
- {
- internal IntPtr dwLower;
- internal IntPtr dwUpper;
- };
-}
-
-#endif
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/Secur32.netfx.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/Secur32.netfx.cs
deleted file mode 100644
index 55a391c79b..0000000000
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/Secur32.netfx.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if NETFRAMEWORK
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Interop.Windows.Secur32
-{
- internal static class Secur32
- {
- private const string DllName = "secur32.dll";
-
- [DllImport("secur32.dll", ExactSpelling = true, SetLastError = true)]
- internal static extern uint QueryContextAttributes(
- ref CredHandle contextHandle,
- [In] ContextAttribute attribute,
- [In] IntPtr buffer);
- }
-}
-
-#endif
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
index b37f97ac17..46375fbf20 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
@@ -361,13 +361,6 @@ internal static InvalidOperationException MethodCalledTwice(string method)
return e;
}
- internal static ArgumentOutOfRangeException ArgumentOutOfRange(string message, string parameterName, object value)
- {
- ArgumentOutOfRangeException e = new(parameterName, value, message);
- TraceExceptionAsReturnValue(e);
- return e;
- }
-
internal static AuthenticationException SSLCertificateAuthenticationException(string message)
{
AuthenticationException e = new(message);
@@ -457,9 +450,6 @@ internal static ArgumentOutOfRangeException InvalidUserDefinedTypeSerializationF
return InvalidEnumerationValue(typeof(Format), (int)value);
}
- internal static ArgumentOutOfRangeException NotSupportedUserDefinedTypeSerializationFormat(Format value, string method)
- => NotSupportedEnumerationValue(typeof(Format), value.ToString(), method);
-
internal static ArgumentException InvalidArgumentLength(string argumentName, int limit)
=> Argument(StringsHelper.GetString(Strings.ADP_InvalidArgumentLength, argumentName, limit));
@@ -1079,9 +1069,6 @@ internal static Exception InvalidDataLength(long length)
internal static bool CompareInsensitiveInvariant(string strvalue, string strconst)
=> 0 == CultureInfo.InvariantCulture.CompareInfo.Compare(strvalue, strconst, CompareOptions.IgnoreCase);
- internal static int DstCompare(string strA, string strB) // this is null safe
- => CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, ADP.DefaultCompareOptions);
-
internal static void SetCurrentTransaction(Transaction transaction) => Transaction.Current = transaction;
internal static Exception NonSeqByteAccess(long badIndex, long currIndex, string method)
@@ -1237,11 +1224,6 @@ internal static Exception UndefinedCollection(string collectionName)
internal static Exception AmbiguousCollectionName(string collectionName)
=> Argument(StringsHelper.GetString(Strings.MDF_AmbiguousCollectionName, collectionName));
- internal static Exception MissingDataSourceInformationColumn() => Argument(StringsHelper.GetString(Strings.MDF_MissingDataSourceInformationColumn));
-
- internal static Exception IncorrectNumberOfDataSourceInformationRows()
- => Argument(StringsHelper.GetString(Strings.MDF_IncorrectNumberOfDataSourceInformationRows));
-
internal static Exception MissingRestrictionColumn() => Argument(StringsHelper.GetString(Strings.MDF_MissingRestrictionColumn));
internal static Exception MissingRestrictionRow() => Argument(StringsHelper.GetString(Strings.MDF_MissingRestrictionRow));
@@ -1398,13 +1380,6 @@ internal static Exception InvalidMixedUsageOfAccessTokenCallbackAndIntegratedSec
internal static readonly IntPtr s_ptrZero = IntPtr.Zero;
#if NETFRAMEWORK
#region netfx project only
- internal static Task CreatedTaskWithException(Exception ex)
- {
- TaskCompletionSource completion = new();
- completion.SetException(ex);
- return completion.Task;
- }
-
//
// Helper Functions
//
@@ -1501,14 +1476,6 @@ internal static Exception PermissionTypeMismatch()
return Argument(StringsHelper.GetString(Strings.ADP_PermissionTypeMismatch));
}
- //
- // DbDataReader
- //
- internal static Exception NumericToDecimalOverflow()
- {
- return InvalidCast(StringsHelper.GetString(Strings.ADP_NumericToDecimalOverflow));
- }
-
//
// DbDataAdapter
//
@@ -1526,79 +1493,12 @@ internal static InvalidOperationException ComputerNameEx(int lastError)
internal const float FailoverTimeoutStepForTnir = 0.125F; // Fraction of timeout to use in case of Transparent Network IP resolution.
internal const int MinimumTimeoutForTnirMs = 500; // The first login attempt in Transparent network IP Resolution
- internal static readonly int s_ptrSize = IntPtr.Size;
- internal static readonly IntPtr s_invalidPtr = new(-1); // use for INVALID_HANDLE
-
internal static readonly bool s_isWindowsNT = (PlatformID.Win32NT == Environment.OSVersion.Platform);
- internal static readonly bool s_isPlatformNT5 = (ADP.s_isWindowsNT && (Environment.OSVersion.Version.Major >= 5));
-
- [FileIOPermission(SecurityAction.Assert, AllFiles = FileIOPermissionAccess.PathDiscovery)]
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
- internal static string GetFullPath(string filename)
- { // MDAC 77686
- return Path.GetFullPath(filename);
- }
-
- // TODO: cache machine name and listen to longhorn event to reset it
- internal static string GetComputerNameDnsFullyQualified()
- {
- const int ComputerNameDnsFullyQualified = 3; // winbase.h, enum COMPUTER_NAME_FORMAT
- const int ERROR_MORE_DATA = 234; // winerror.h
-
- string value;
- if (s_isPlatformNT5)
- {
- int length = 0; // length parameter must be zero if buffer is null
- // query for the required length
- // VSTFDEVDIV 479551 - ensure that GetComputerNameEx does not fail with unexpected values and that the length is positive
- int getComputerNameExError = 0;
- if (0 == Kernel32Safe.GetComputerNameEx(ComputerNameDnsFullyQualified, null, ref length))
- {
- getComputerNameExError = Marshal.GetLastWin32Error();
- }
- if ((getComputerNameExError != 0 && getComputerNameExError != ERROR_MORE_DATA) || length <= 0)
- {
- throw ADP.ComputerNameEx(getComputerNameExError);
- }
-
- StringBuilder buffer = new(length);
- length = buffer.Capacity;
- if (0 == Kernel32Safe.GetComputerNameEx(ComputerNameDnsFullyQualified, buffer, ref length))
- {
- throw ADP.ComputerNameEx(Marshal.GetLastWin32Error());
- }
-
- // Note: In Longhorn you'll be able to rename a machine without
- // rebooting. Therefore, don't cache this machine name.
- value = buffer.ToString();
- }
- else
- {
- value = ADP.MachineName();
- }
- return value;
- }
-
- internal static IntPtr IntPtrOffset(IntPtr pbase, int offset)
- {
- if (4 == ADP.s_ptrSize)
- {
- return (IntPtr)checked(pbase.ToInt32() + offset);
- }
- Debug.Assert(8 == ADP.s_ptrSize, "8 != IntPtr.Size"); // MDAC 73747
- return (IntPtr)checked(pbase.ToInt64() + offset);
- }
#endregion
#else
#region netcore project only
- //
- // COM+ exceptions
- //
- internal static PlatformNotSupportedException DbTypeNotSupported(string dbType) => new(StringsHelper.GetString(Strings.SQL_DbTypeNotSupportedOnThisPlatform, dbType));
-
// IDbConnection.BeginTransaction, OleDbTransaction.Begin
internal static ArgumentOutOfRangeException InvalidIsolationLevel(IsolationLevel value)
{
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionString.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionString.netfx.cs
index a0e0d0f6a7..56af12e08d 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionString.netfx.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionString.netfx.cs
@@ -51,12 +51,10 @@ internal DbConnectionString(
string value,
string restrictions,
KeyRestrictionBehavior behavior,
- IReadOnlyDictionary synonyms,
- bool useOdbcRules)
+ IReadOnlyDictionary synonyms)
: this(new DbConnectionOptions(value, synonyms), restrictions, behavior, synonyms, false)
{
- // useOdbcRules is only used to parse the connection string, not to parse restrictions because values don't apply there
- // the hashtable doesn't need clone since it isn't shared with anything else
+ // The IReadOnlyDictionary doesn't need to be cloned since it isn't shared with anything else
}
internal DbConnectionString(DbConnectionOptions connectionOptions)
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
index 3e27bf5305..dda18faa70 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
@@ -675,9 +675,6 @@ internal void MakePooledConnection(IDbConnectionPool connectionPool)
Pool = connectionPool;
}
- internal void NotifyWeakReference(int message) =>
- ReferenceCollection?.Notify(message);
-
internal virtual void OpenConnection(DbConnection outerConnection, SqlConnectionFactory connectionFactory)
{
if (!TryOpenConnection(outerConnection, connectionFactory, null, null))
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbReferenceCollection.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbReferenceCollection.cs
index 3f564a71db..843f600b59 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbReferenceCollection.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbReferenceCollection.cs
@@ -174,7 +174,7 @@ internal T FindItem(int refInfo, Func filterMethod) where T : class
return null;
}
- public void Notify(int message)
+ public void Deactivate()
{
bool lockObtained = false;
try
@@ -186,14 +186,14 @@ public void Notify(int message)
{
_isNotifying = true;
- // Loop through each live item and notify it
+ // Loop through each live item and notify it of its parent's deactivation
if (_estimatedCount > 0)
{
for (int index = 0; index <= _lastItemIndex; ++index)
{
if (_items[index].TryGetTarget(out object value))
{
- NotifyItem(message, _items[index].RefInfo, value);
+ NotifyItem(_items[index].RefInfo, value);
_items[index].RemoveTarget();
}
Debug.Assert(!_items[index].TryGetTarget(out _), "Unexpected target after notifying");
@@ -220,7 +220,7 @@ public void Notify(int message)
}
}
- abstract protected void NotifyItem(int message, int refInfo, object value);
+ abstract protected void NotifyItem(int refInfo, object value);
abstract public void Remove(object value);
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientPermission.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientPermission.netfx.cs
index 0b8da2a31c..b42310af12 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientPermission.netfx.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientPermission.netfx.cs
@@ -106,7 +106,7 @@ private bool _IsUnrestricted
///
public override void Add(string connectionString, string restrictions, KeyRestrictionBehavior behavior)
{
- DbConnectionString constr = new DbConnectionString(connectionString, restrictions, behavior, SqlConnectionString.KeywordMap, false);
+ DbConnectionString constr = new DbConnectionString(connectionString, restrictions, behavior, SqlConnectionString.KeywordMap);
AddPermissionEntry(constr);
}
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientSymmetricKey.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientSymmetricKey.cs
index af96d947f0..a325073637 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientSymmetricKey.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientSymmetricKey.cs
@@ -41,25 +41,5 @@ internal virtual byte[] RootKey
return _rootKey;
}
}
-
- ///
- /// Computes SHA256 value of the plain text key bytes
- ///
- /// A string containing SHA256 hash of the root key
- internal virtual string GetKeyHash()
- {
- return SqlSecurityUtility.GetSHA256Hash(RootKey);
- }
-
- ///
- /// Gets the length of the root key
- ///
- ///
- /// Returns the length of the root key
- ///
- internal virtual int Length()
- {
- return _rootKey.Length;
- }
}
}
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlReferenceCollection.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlReferenceCollection.cs
index 4ee4d625f3..b0b5917551 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlReferenceCollection.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlReferenceCollection.cs
@@ -43,11 +43,6 @@ public override void Add(object value, int tag)
base.AddItem(value, tag);
}
- internal void Deactivate()
- {
- base.Notify(0);
- }
-
internal SqlDataReader FindLiveReader(SqlCommand command)
{
if (command is null)
@@ -67,9 +62,8 @@ internal SqlDataReader FindLiveReader(SqlCommand command)
}
}
- protected override void NotifyItem(int message, int tag, object value)
+ protected override void NotifyItem(int tag, object value)
{
- Debug.Assert(0 == message, "unexpected message?");
Debug.Assert(DataReaderTag == tag || CommandTag == tag || BulkCopyTag == tag, "unexpected tag?");
if (tag == DataReaderTag)
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlSecurityUtility.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlSecurityUtility.cs
index 8fbe908379..ae20c27254 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlSecurityUtility.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlSecurityUtility.cs
@@ -41,22 +41,6 @@ internal static void GetHMACWithSHA256(byte[] plainText, byte[] key, byte[] hash
}
}
- ///
- /// Computes SHA256 hash of a given input
- ///
- /// input byte array which needs to be hashed
- /// Returns SHA256 hash in a string form
- internal static string GetSHA256Hash(byte[] input)
- {
- Debug.Assert(input != null);
-
- using (SHA256 sha256 = SHA256.Create())
- {
- byte[] hashValue = sha256.ComputeHash(input);
- return GetHexString(hashValue);
- }
- }
-
///
/// Generates cryptographically random bytes
///
@@ -102,34 +86,6 @@ internal static bool CompareBytes(byte[] buffer1, byte[] buffer2, int buffer2Ind
return true;
}
- ///
- /// Gets hex representation of byte array.
- /// input byte array
- ///
- internal static string GetHexString(byte[] input)
- {
- Debug.Assert(input != null);
-
- StringBuilder str = new();
- foreach (byte b in input)
- {
- str.AppendFormat(b.ToString(@"X2"));
- }
-
- return str.ToString();
- }
-
- ///
- /// Returns the caller's function name in the format of [ClassName].[FunctionName]
- ///
- internal static string GetCurrentFunctionName()
- {
- StackTrace stackTrace = new StackTrace();
- StackFrame stackFrame = stackTrace.GetFrame(1);
- MethodBase methodBase = stackFrame.GetMethod();
- return string.Format(@"{0}.{1}", methodBase.DeclaringType.Name, methodBase.Name);
- }
-
///
/// Return the algorithm name mapped to an Id.
///
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
index fd814370b5..540cf3b95c 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
@@ -316,10 +316,6 @@ internal static Exception CannotGetDTCAddress()
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_CannotGetDTCAddress));
}
- static internal Exception InvalidOptionLength(string key)
- {
- return ADP.Argument(StringsHelper.GetString(Strings.SQL_InvalidOptionLength, key));
- }
internal static Exception InvalidInternalPacketSize(string str)
{
return ADP.ArgumentOutOfRange(str);
@@ -349,10 +345,6 @@ static internal Exception CredentialsNotProvided(SqlAuthenticationMethod auth)
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_CredentialsNotProvided, DbConnectionStringUtilities.AuthenticationTypeToString(auth)));
}
- static internal Exception InvalidCertAuth()
- {
- return ADP.Argument(StringsHelper.GetString(Strings.SQL_Certificate));
- }
internal static Exception AuthenticationAndIntegratedSecurity()
{
return ADP.Argument(StringsHelper.GetString(Strings.SQL_AuthenticationAndIntegratedSecurity));
@@ -439,10 +431,6 @@ internal static Exception ConnectionLockedForBcpEvent()
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ConnectionLockedForBcpEvent));
}
- internal static Exception FatalTimeout()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_FatalTimeout));
- }
internal static Exception InstanceFailure()
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_InstanceFailure));
@@ -455,10 +443,6 @@ internal static Exception ChangePasswordConflictsWithSSPI()
{
return ADP.Argument(StringsHelper.GetString(Strings.SQL_ChangePasswordConflictsWithSSPI));
}
- internal static Exception ChangePasswordRequires2005()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ChangePasswordRequiresYukon));
- }
internal static Exception UnknownSysTxIsolationLevel(System.Transactions.IsolationLevel isolationLevel)
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_UnknownSysTxIsolationLevel, isolationLevel.ToString()));
@@ -510,11 +494,6 @@ internal static Exception UnsupportedAuthentication(string authentication)
return ADP.NotSupported(StringsHelper.GetString(Strings.SQL_UnsupportedAuthentication, authentication));
}
- internal static Exception UnsupportedSqlAuthenticationMethod(SqlAuthenticationMethod authentication)
- {
- return ADP.NotSupported(StringsHelper.GetString(Strings.SQL_UnsupportedSqlAuthenticationMethod, authentication));
- }
-
internal static Exception UnsupportedAuthenticationSpecified(SqlAuthenticationMethod authentication)
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_UnsupportedAuthenticationSpecified, authentication));
@@ -530,11 +509,6 @@ internal static Exception CannotCreateSqlAuthInitializer(string type, Exception
return ADP.Argument(StringsHelper.GetString(Strings.SQL_CannotCreateAuthInitializer, type), e);
}
- internal static Exception CannotInitializeAuthProvider(string type, Exception e)
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_CannotInitializeAuthProvider, type), e);
- }
-
internal static Exception UnsupportedAuthenticationByProvider(string authentication, string type)
{
return ADP.NotSupported(StringsHelper.GetString(Strings.SQL_UnsupportedAuthenticationByProvider, type, authentication));
@@ -545,11 +519,6 @@ internal static Exception CannotFindAuthProvider(string authentication)
return ADP.Argument(StringsHelper.GetString(Strings.SQL_CannotFindAuthProvider, authentication));
}
- internal static Exception CannotGetAuthProviderConfig(Exception e)
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_CannotGetAuthProviderConfig), e);
- }
-
internal static Exception ParameterCannotBeEmpty(string paramName)
{
return ADP.ArgumentNull(StringsHelper.GetString(Strings.SQL_ParameterCannotBeEmpty, paramName));
@@ -578,11 +547,6 @@ internal static Exception ActiveDirectoryTokenRetrievingTimeout(string authentic
//
// SQL.DataCommand
//
- internal static Exception NotificationsRequire2005()
- {
- return ADP.NotSupported(StringsHelper.GetString(Strings.SQL_NotificationsRequireYukon));
- }
-
internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, int value)
{
return ADP.ArgumentOutOfRange(StringsHelper.GetString(Strings.SQL_NotSupportedEnumerationValue, type.Name, value.ToString(System.Globalization.CultureInfo.InvariantCulture)), type.Name);
@@ -699,10 +663,6 @@ internal static Exception UnexpectedTypeNameForNonStructParams(string paramName)
{
return ADP.NotSupported(StringsHelper.GetString(Strings.SqlParameter_UnexpectedTypeNameForNonStruct, paramName));
}
- internal static Exception SingleValuedStructNotSupported()
- {
- return ADP.NotSupported(StringsHelper.GetString(Strings.MetaType_SingleValuedStructNotSupported));
- }
internal static Exception ParameterInvalidVariant(string paramName)
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ParameterInvalidVariant, paramName));
@@ -792,10 +752,6 @@ internal static Exception TimeOverflow(string time)
{
return ADP.Overflow(StringsHelper.GetString(Strings.SQL_TimeOverflow, time));
}
- internal static Exception InvalidServerCertificate()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_InvalidServerCertificate));
- }
//
// SQL.SqlDataReader
@@ -925,18 +881,9 @@ internal static TransactionPromotionException PromotionFailed(Exception inner)
return e;
}
- static internal Exception SqlNotificationException(SqlNotificationEventArgs notify)
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQLNotify_ErrorFormat, notify.Type, notify.Info, notify.Source));
- }
-
//
// SQL.SqlMetaData
//
- internal static Exception SqlMetaDataNoMetaData()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlMetaData_NoMetadata));
- }
internal static Exception UnexpectedUdtTypeNameForNonUdtParams()
{
return ADP.Argument(StringsHelper.GetString(Strings.SQLUDT_UnexpectedUdtTypeName));
@@ -975,10 +922,6 @@ internal static Exception MustSpecifyBothSortOrderAndOrdinal(SortOrder order, in
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlMetaData_SpecifyBothSortOrderAndOrdinal, order.ToString(), ordinal));
}
- internal static Exception TableTypeCanOnlyBeParameter()
- {
- return ADP.Argument(StringsHelper.GetString(Strings.SQLTVP_TableTypeCanOnlyBeParameter));
- }
internal static Exception UnsupportedColumnTypeForSqlProvider(string columnName, string typeName)
{
return ADP.Argument(StringsHelper.GetString(Strings.SqlProvider_InvalidDataColumnType, columnName, typeName));
@@ -1229,15 +1172,6 @@ internal static Exception ROR_RecursiveRoutingNotSupported(SqlInternalConnection
return exc;
}
- internal static Exception ROR_UnexpectedRoutingInfo(SqlInternalConnectionTds internalConnection)
- {
- SqlErrorCollection errors = new SqlErrorCollection();
- errors.Add(new SqlError(0, (byte)0x00, TdsEnums.FATAL_ERROR_CLASS, null, (StringsHelper.GetString(Strings.SQLROR_UnexpectedRoutingInfo)), "", 0));
- SqlException exc = SqlException.CreateException(errors, null, internalConnection, innerException: null, batchCommand: null);
- exc._doNotReconnect = true;
- return exc;
- }
-
internal static Exception ROR_InvalidRoutingInfo(SqlInternalConnectionTds internalConnection)
{
SqlErrorCollection errors = new SqlErrorCollection();
@@ -1353,16 +1287,6 @@ internal static System.Data.SqlTypes.SqlNullValueException SqlNullValue()
ADP.TraceExceptionAsReturnValue(e);
return e;
}
- // SQLBU 402363: Exception to prevent Parameter.Size data corruption case from working.
- // This should be temporary until changing to correct behavior can be safely implemented.
- static internal Exception ParameterSizeRestrictionFailure(int index)
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.OleDb_CommandParameterError, index.ToString(CultureInfo.InvariantCulture), "SqlParameter.Size"));
- }
- internal static Exception SubclassMustOverride()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SqlMisc_SubclassMustOverride));
- }
// ProjectK\CoreCLR specific errors
internal static Exception UnsupportedKeyword(string keyword)
@@ -1373,26 +1297,6 @@ internal static Exception NetworkLibraryKeywordNotSupported()
{
return ADP.NotSupported(StringsHelper.GetString(Strings.SQL_NetworkLibraryNotSupported));
}
- internal static Exception UnsupportedFeatureAndToken(SqlInternalConnectionTds internalConnection, string token)
- {
- var innerException = ADP.NotSupported(StringsHelper.GetString(Strings.SQL_UnsupportedToken, token));
-
- SqlErrorCollection errors = new SqlErrorCollection();
- errors.Add(new SqlError(0, 0, TdsEnums.FATAL_ERROR_CLASS, null, StringsHelper.GetString(Strings.SQL_UnsupportedFeature), "", 0));
- SqlException exc = SqlException.CreateException(errors, "", internalConnection, innerException);
- return exc;
- }
-
- internal static Exception Azure_ManagedIdentityException(string msg)
- {
- SqlErrorCollection errors = new SqlErrorCollection
- {
- new SqlError(0, (byte)0x00, TdsEnums.FATAL_ERROR_CLASS, null, msg, "", 0)
- };
- SqlException exc = SqlException.CreateException(errors, null);
- exc._doNotReconnect = true; // disable open retry logic on this error
- return exc;
- }
#region Always Encrypted Errors
@@ -1744,11 +1648,6 @@ internal static Exception NullPlainText()
return ADP.ArgumentNull(StringsHelper.GetString(Strings.TCE_NullPlainText));
}
- static internal Exception VeryLargeCiphertext(long cipherTextLength, long maxCipherTextSize, long plainTextLength)
- {
- return ADP.Argument(StringsHelper.GetString(Strings.TCE_VeryLargeCiphertext, cipherTextLength, maxCipherTextSize, plainTextLength));
- }
-
internal static Exception NullCipherText()
{
return ADP.ArgumentNull(StringsHelper.GetString(Strings.TCE_NullCipherText));
@@ -1963,21 +1862,6 @@ internal static Exception EmptyArgumentInternal(string argumentName, string type
#region Always Encrypted - Enclave provider/configuration errors
- internal static Exception CannotGetSqlColumnEncryptionEnclaveProviderConfig(Exception innerException)
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_CannotGetSqlColumnEncryptionEnclaveProviderConfig, innerException.Message), innerException);
- }
-
- internal static Exception CannotCreateSqlColumnEncryptionEnclaveProvider(string providerName, string type, Exception innerException)
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_CannotCreateSqlColumnEncryptionEnclaveProvider, providerName, type, innerException.Message), innerException);
- }
-
- internal static Exception SqlColumnEncryptionEnclaveProviderNameCannotBeEmpty()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_SqlColumnEncryptionEnclaveProviderNameCannotBeEmpty));
- }
-
internal static Exception NoAttestationUrlSpecifiedForEnclaveBasedQuerySpDescribe(string enclaveType)
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_NoAttestationUrlSpecifiedForEnclaveBasedQuerySpDescribe, "sp_describe_parameter_encryption", enclaveType));
@@ -1993,11 +1877,6 @@ internal static Exception EnclaveTypeNullForEnclaveBasedQuery()
return ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_EnclaveTypeNullForEnclaveBasedQuery));
}
- internal static Exception EnclaveProvidersNotConfiguredForEnclaveBasedQuery()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_EnclaveProvidersNotConfiguredForEnclaveBasedQuery));
- }
-
internal static Exception EnclaveProviderNotFound(string enclaveType, string attestationProtocol = null)
{
return attestationProtocol != null ? ADP.InvalidOperation(StringsHelper.GetString(Strings.TCE_EnclaveProviderNotFound, enclaveType, attestationProtocol))
@@ -2205,25 +2084,6 @@ static internal Exception ContextConnectionIsUnsupported()
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ContextConnectionIsUnsupported));
}
- static internal Exception NestedTransactionScopesNotSupported()
- {
- return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_NestedTransactionScopesNotSupported));
- }
-
- // @TODO: Check these methods for usage
- static internal Exception ArgumentLengthMismatch(string arg1, string arg2)
- {
- return ADP.Argument(StringsHelper.GetString(Strings.SQL_ArgumentLengthMismatch, arg1, arg2));
- }
- static internal Exception InvalidSqlDbTypeOneAllowedType(SqlDbType invalidType, string method, SqlDbType allowedType)
- {
- return ADP.Argument(StringsHelper.GetString(Strings.SQL_InvalidSqlDbTypeWithOneAllowedType, invalidType, method, allowedType));
- }
- static internal Exception TooManyValues(string arg)
- {
- return ADP.Argument(StringsHelper.GetString(Strings.SQL_TooManyValues), arg);
- }
-
///
/// gets a message for SNI error (sniError must be valid, non-zero error code)
///
@@ -2241,10 +2101,6 @@ internal static string GetSNIErrorMessage(uint sniError)
internal const string SqlNotificationServiceDefault = "SqlQueryNotificationService";
internal const string SqlNotificationStoredProcedureDefault = "SqlQueryNotificationStoredProcedure";
- // constant strings
- internal const string Transaction = "Transaction";
- internal const string Connection = "Connection";
-
private static IEnumerable Map(IEnumerable source, Func selector)
{
if (source == null)
@@ -2302,10 +2158,6 @@ internal static string EncryptionNotSupportedByServer()
{
return StringsHelper.GetString(Strings.SQL_EncryptionNotSupportedByServer);
}
- internal static string CTAIPNotSupportedByServer()
- {
- return StringsHelper.GetString(Strings.SQL_CTAIPNotSupportedByServer);
- }
internal static string OperationCancelled()
{
return StringsHelper.GetString(Strings.SQL_OperationCancelled);
@@ -2322,10 +2174,6 @@ internal static string SSPIGenerateError()
{
return StringsHelper.GetString(Strings.SQL_SSPIGenerateError);
}
- internal static string KerberosTicketMissingError()
- {
- return StringsHelper.GetString(Strings.SQL_KerberosTicketMissingError);
- }
internal static string Timeout()
{
return StringsHelper.GetString(Strings.SQL_Timeout_Execution);
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs
index a0556445c2..42160f9851 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs
@@ -4439,10 +4439,6 @@ internal void ResetSnapshot()
_snapshotStatus = SnapshotStatus.NotActive;
}
- internal bool IsSnapshotAvailable()
- {
- return _snapshot != null && _snapshot.ContinueEnabled;
- }
///
/// Returns true if the state object is in the state of continuing from a previously stored snapshot packet
/// meaning that consumers should resume from the point where they last needed more data instead of beginning