Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -1 +1 @@
71092075d227694f12a3b1b21c6ca70412849015
f8880b5d09ba0af05986f7f82be2593ae8caf155

View File

@@ -15,6 +15,7 @@ namespace System.Data.Common {
internal static class NativeMethods {
#if !NO_OLEDB
[Guid("0c733a1e-2a1c-11ce-ade5-00aa0044773d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport]
internal interface ISourcesRowset {
@@ -25,6 +26,7 @@ namespace System.Data.Common {
[In] IntPtr rgProperties,
[Out, MarshalAs(UnmanagedType.Interface)] out object ppRowset);
}
#endif
[Guid("0C733A5E-2A1C-11CE-ADE5-00AA0044773D"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown), ComImport]
internal interface ITransactionJoin {

View File

@@ -290,7 +290,7 @@ internal static partial class Bid
}
}
#if !NO_ODBC
//
// Manually edited wrappers
//
@@ -311,7 +311,9 @@ internal static partial class Bid
if (((System.Data.Odbc.ODBC32.RetCode.SUCCESS != a1) || (modFlags & ApiGroup.StatusOk) != 0) && (modFlags & ApiGroup.Trace) != 0 && modID != NoData)
NativeMethods.Trace (modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, (int)(short)a1, a2);
}
#endif
#if !NO_OLEDB
[BidMethod]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal static void Trace(string fmtPrintfW, System.Data.OleDb.OleDbHResult a1) { //
@@ -336,7 +338,7 @@ internal static partial class Bid
if ((modFlags & ApiGroup.Trace) != 0 && modID != NoData)
NativeMethods.Trace (modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, (int)a1,a2);
}
#endif
[BidMethod]
internal static void Trace(string fmtPrintfW, System.String a1, System.String a2) {

View File

@@ -8,7 +8,9 @@
//------------------------------------------------------------------------------
using System;
#if !NO_ODBC
using System.Data.Odbc;
#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
@@ -22,6 +24,7 @@ namespace System.Data.Common {
[SuppressUnmanagedCodeSecurityAttribute()]
internal static class UnsafeNativeMethods {
#if !NO_ODBC
//
// ODBC32
//
@@ -462,7 +465,9 @@ namespace System.Data.Common {
[In, MarshalAs(UnmanagedType.LPWStr)]
/*SQLCHAR* */string TableType,
/*SQLSMALLINT*/Int16 NameLen4);
#endif
#if !NO_OLEDB
//
// Oleaut32
//
@@ -1222,6 +1227,7 @@ namespace System.Data.Common {
IntPtr pUnkOuter,
ref Guid riid,
[MarshalAs(UnmanagedType.Interface)] ref object ppCommand);
#endif
//
// Advapi32.dll Integrated security functions

View File

@@ -1 +1 @@
504cdd268bba444611568abb32a7ae89b3f41cd5
cb0c072a6596823dda1c71424cf7f7567719a28b

View File

@@ -131,7 +131,9 @@ namespace System.Data.ProviderBase {
DbConnectionInternal newConnection = CreateConnection(connectionOptions, poolKey, poolGroupProviderInfo, null, owningConnection, userOptions);
if (null != newConnection) {
#if !MOBILE
PerformanceCounters.HardConnectsPerSecond.Increment();
#endif
newConnection.MakeNonPooledObject(owningConnection, PerformanceCounters);
}
Bid.Trace("<prov.DbConnectionFactory.CreateNonPooledConnection|RES|CPOOL> %d#, Non-pooled database connection created.\n", ObjectID);
@@ -144,7 +146,9 @@ namespace System.Data.ProviderBase {
DbConnectionInternal newConnection = CreateConnection(options, poolKey, poolGroupProviderInfo, pool, owningObject, userOptions);
if (null != newConnection) {
#if !MOBILE
PerformanceCounters.HardConnectsPerSecond.Increment();
#endif
newConnection.MakePooledConnection(pool);
}
Bid.Trace("<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> %d#, Pooled database connection created.\n", ObjectID);
@@ -277,7 +281,9 @@ namespace System.Data.ProviderBase {
}
else {
if (retry.TrySetResult(task.Result)) {
#if !MOBILE
PerformanceCounters.NumberOfNonPooledConnections.Increment();
#endif
}
else {
// The outer TaskCompletionSource was already completed
@@ -293,7 +299,9 @@ namespace System.Data.ProviderBase {
}
connection = CreateNonPooledConnection(owningConnection, poolGroup, userOptions);
#if !MOBILE
PerformanceCounters.NumberOfNonPooledConnections.Increment();
#endif
}
else {
if (owningConnection.ForceNewConnection) {
@@ -425,7 +433,9 @@ namespace System.Data.ProviderBase {
// lock prevents race condition with PruneConnectionPoolGroups
newConnectionPoolGroups.Add(key, newConnectionPoolGroup);
#if !MOBILE
PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment();
#endif
connectionPoolGroup = newConnectionPoolGroup;
_connectionPoolGroups = newConnectionPoolGroups;
}
@@ -483,7 +493,9 @@ namespace System.Data.ProviderBase {
if (Bid.AdvancedOn) {
Bid.Trace("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %d#, ReleasePool=%d#\n", ObjectID, pool.ObjectID);
}
#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPools.Decrement();
#endif
}
}
}
@@ -505,7 +517,9 @@ namespace System.Data.ProviderBase {
if (Bid.AdvancedOn) {
Bid.Trace("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %d#, ReleasePoolGroup=%d#\n", ObjectID, poolGroup.ObjectID);
}
#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Decrement();
#endif
}
}
}
@@ -527,7 +541,9 @@ namespace System.Data.ProviderBase {
// move idle entries from last prune pass to a queue for pending release
// otherwise process entry which may move it from active to idle
if (entry.Value.Prune()) { // may add entries to _poolsToRelease
#if !MOBILE
PerformanceCounters.NumberOfActiveConnectionPoolGroups.Decrement();
#endif
QueuePoolGroupForRelease(entry.Value);
}
else {
@@ -556,7 +572,9 @@ namespace System.Data.ProviderBase {
}
_poolsToRelease.Add(pool);
}
#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPools.Increment();
#endif
}
internal void QueuePoolGroupForRelease(DbConnectionPoolGroup poolGroup) {
@@ -566,7 +584,9 @@ namespace System.Data.ProviderBase {
lock (_poolGroupsToRelease) {
_poolGroupsToRelease.Add(poolGroup);
}
#if !MOBILE
PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Increment();
#endif
}
virtual protected DbConnectionInternal CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) {

View File

@@ -207,6 +207,7 @@ namespace NAMESPACE {
partial void RepairInnerConnection();
#if !MOBILE
// NOTE: This is just a private helper because OracleClient V1.1 shipped
// with a different argument name and it's a breaking change to not use
// the same argument names in V2.0 (VB Named Parameter Binding--Ick)
@@ -235,6 +236,7 @@ namespace NAMESPACE {
// we should consider a GC.KeepAlive(this) here.
GC.KeepAlive(this);
}
#endif
override public void EnlistTransaction(SysTx.Transaction transaction) {
CONNECTIONOBJECTNAME.ExecutePermission.Demand();

View File

@@ -356,7 +356,9 @@ namespace System.Data.ProviderBase {
Activate(transaction);
#if !MOBILE
PerformanceCounters.NumberOfActiveConnections.Increment();
#endif
}
internal void AddWeakReference(object value, int tag) {
@@ -448,7 +450,9 @@ namespace System.Data.ProviderBase {
else {
Deactivate(); // ensure we de-activate non-pooled connections, or the data readers and transactions may not get cleaned up...
#if !MOBILE
PerformanceCounters.HardDisconnectsPerSecond.Increment();
#endif
// To prevent an endless recursion, we need to clear
// the owning object before we call dispose so that
@@ -463,11 +467,17 @@ namespace System.Data.ProviderBase {
SetInStasis();
}
else {
#if MONO_PARTIAL_DATA_IMPORT
Dispose();
#else
#if !MOBILE
PerformanceCounters.NumberOfNonPooledConnections.Decrement();
#endif
if (this.GetType() != typeof(System.Data.SqlClient.SqlInternalConnectionSmi))
{
Dispose();
}
#endif
}
}
}
@@ -513,9 +523,11 @@ namespace System.Data.ProviderBase {
Debug.Assert(0 == activateCount, "activated multiple times?");
#endif // DEBUG
#if !MOBILE
if (PerformanceCounters != null) { // Pool.Clear will DestroyObject that will clean performanceCounters before going here
PerformanceCounters.NumberOfActiveConnections.Decrement();
}
#endif
if (!_connectionIsDoomed && Pool.UseLoadBalancing) {
// If we're not already doomed, check the connection's lifetime and
@@ -569,7 +581,9 @@ namespace System.Data.ProviderBase {
// once and for all, or the server will have fits about us
// leaving connections open until the client-side GC kicks
// in.
#if !MOBILE
PerformanceCounters.NumberOfNonPooledConnections.Decrement();
#endif
Dispose();
}
// When _pooledCount is 0, the connection is a pooled connection
@@ -839,7 +853,9 @@ namespace System.Data.ProviderBase {
internal void SetInStasis() {
_isInStasis = true;
Bid.PoolerTrace("<prov.DbConnectionInternal.SetInStasis|RES|CPOOL> %d#, Non-Pooled Connection has Delegated Transaction, waiting to Dispose.\n", ObjectID);
#if !MOBILE
PerformanceCounters.NumberOfStasisConnections.Increment();
#endif
}
private void TerminateStasis(bool returningToPool) {
@@ -849,7 +865,9 @@ namespace System.Data.ProviderBase {
else {
Bid.PoolerTrace("<prov.DbConnectionInternal.TerminateStasis|RES|CPOOL> %d#, Delegated Transaction has ended, connection is closed/leaked. Disposing.\n", ObjectID);
}
#if !MOBILE
PerformanceCounters.NumberOfStasisConnections.Decrement();
#endif
_isInStasis = false;
}

View File

@@ -235,8 +235,9 @@ namespace System.Data.ProviderBase {
Bid.PoolerTrace("<prov.DbConnectionPool.TransactedConnectionPool.PutTransactedObject|RES|CPOOL> %d#, Transaction %d#, Connection %d#, Added.\n", ObjectID, transaction.GetHashCode(), transactedObject.ObjectID );
}
#if !MOBILE
Pool.PerformanceCounters.NumberOfFreeConnections.Increment();
#endif
}
internal void TransactionEnded(SysTx.Transaction transaction, DbConnectionInternal transactedObject)
@@ -300,7 +301,9 @@ namespace System.Data.ProviderBase {
// connections, we'll put it back...
if (0 <= entry)
{
#if !MOBILE
Pool.PerformanceCounters.NumberOfFreeConnections.Decrement();
#endif
Pool.PutObjectFromTransactedPool(transactedObject);
}
}
@@ -622,7 +625,9 @@ namespace System.Data.ProviderBase {
if (_stackOld.TryPop(out obj)) {
Debug.Assert(obj != null, "null connection is not expected");
// If we obtained one from the old stack, destroy it.
#if !MOBILE
PerformanceCounters.NumberOfFreeConnections.Decrement();
#endif
// Transaction roots must survive even aging out (TxEnd event will clean them up).
bool shouldDestroy = true;
@@ -709,12 +714,16 @@ namespace System.Data.ProviderBase {
// Second, dispose of all the free connections.
while (_stackNew.TryPop(out obj)) {
Debug.Assert(obj != null, "null connection is not expected");
#if !MOBILE
PerformanceCounters.NumberOfFreeConnections.Decrement();
#endif
DestroyObject(obj);
}
while (_stackOld.TryPop(out obj)) {
Debug.Assert(obj != null, "null connection is not expected");
#if !MOBILE
PerformanceCounters.NumberOfFreeConnections.Decrement();
#endif
DestroyObject(obj);
}
@@ -748,7 +757,9 @@ namespace System.Data.ProviderBase {
}
_objectList.Add(newObj);
_totalObjects = _objectList.Count;
#if !MOBILE
PerformanceCounters.NumberOfPooledConnections.Increment(); //
#endif
}
// If the old connection belonged to another pool, we need to remove it from that
@@ -964,12 +975,16 @@ namespace System.Data.ProviderBase {
if (removed) {
Bid.PoolerTrace("<prov.DbConnectionPool.DestroyObject|RES|CPOOL> %d#, Connection %d#, Removed from pool.\n", ObjectID, obj.ObjectID);
#if !MOBILE
PerformanceCounters.NumberOfPooledConnections.Decrement();
#endif
}
obj.Dispose();
Bid.PoolerTrace("<prov.DbConnectionPool.DestroyObject|RES|CPOOL> %d#, Connection %d#, Disposed.\n", ObjectID, obj.ObjectID);
#if !MOBILE
PerformanceCounters.HardDisconnectsPerSecond.Increment();
#endif
}
}
@@ -1159,7 +1174,9 @@ namespace System.Data.ProviderBase {
DbConnectionInternal obj = null;
SysTx.Transaction transaction = null;
#if !MOBILE
PerformanceCounters.SoftConnectsPerSecond.Increment();
#endif
Bid.PoolerTrace("<prov.DbConnectionPool.GetConnection|RES|CPOOL> %d#, Getting connection.\n", ObjectID);
@@ -1192,10 +1209,12 @@ namespace System.Data.ProviderBase {
finally {
waitResult = SafeNativeMethods.WaitForMultipleObjectsEx(waitHandleCount, _waitHandles.DangerousGetHandle(), false, waitForMultipleObjectsTimeout, false);
#if !FULL_AOT_RUNTIME
// VSTFDEVDIV 479551 - call GetHRForLastWin32Error immediately after after the native call
if (waitResult == WAIT_FAILED) {
waitForMultipleObjectsExHR = Marshal.GetHRForLastWin32Error();
}
#endif
}
// From the WaitAny docs: "If more than one object became signaled during
@@ -1316,7 +1335,9 @@ namespace System.Data.ProviderBase {
if (CREATION_HANDLE == waitResult) {
int result = SafeNativeMethods.ReleaseSemaphore(_waitHandles.CreationHandle.DangerousGetHandle(), 1, IntPtr.Zero);
if (0 == result) { // failure case
#if !FULL_AOT_RUNTIME
releaseSemaphoreResult = Marshal.GetHRForLastWin32Error();
#endif
}
}
if (mustRelease) {
@@ -1364,7 +1385,9 @@ namespace System.Data.ProviderBase {
/// <param name="oldConnection">Inner connection that will be replaced</param>
/// <returns>A new inner connection that is attached to the <paramref name="owningObject"/></returns>
internal DbConnectionInternal ReplaceConnection(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) {
#if !MOBILE
PerformanceCounters.SoftConnectsPerSecond.Increment();
#endif
Bid.PoolerTrace("<prov.DbConnectionPool.ReplaceConnection|RES|CPOOL> %d#, replacing connection.\n", ObjectID);
DbConnectionInternal newConnection = UserCreateRequest(owningObject, userOptions, oldConnection);
@@ -1402,7 +1425,9 @@ namespace System.Data.ProviderBase {
if (null != obj) {
Bid.PoolerTrace("<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> %d#, Connection %d#, Popped from general pool.\n", ObjectID, obj.ObjectID);
#if !MOBILE
PerformanceCounters.NumberOfFreeConnections.Decrement();
#endif
}
return(obj);
}
@@ -1416,7 +1441,9 @@ namespace System.Data.ProviderBase {
if (null != obj) {
Bid.PoolerTrace("<prov.DbConnectionPool.GetFromTransactedPool|RES|CPOOL> %d#, Connection %d#, Popped from transacted pool.\n", ObjectID, obj.ObjectID);
#if !MOBILE
PerformanceCounters.NumberOfFreeConnections.Decrement();
#endif
if (obj.IsTransactionRoot) {
try {
@@ -1560,14 +1587,17 @@ namespace System.Data.ProviderBase {
_stackNew.Push(obj);
_waitHandles.PoolSemaphore.Release(1);
#if !MOBILE
PerformanceCounters.NumberOfFreeConnections.Increment();
#endif
}
internal void PutObject(DbConnectionInternal obj, object owningObject) {
Debug.Assert(null != obj, "null obj?");
#if !MOBILE
PerformanceCounters.SoftDisconnectsPerSecond.Increment();
#endif
// Once a connection is closing (which is the state that we're in at
// this point in time) you cannot delegate a transaction to or enlist
@@ -1671,7 +1701,9 @@ namespace System.Data.ProviderBase {
DbConnectionInternal obj = reclaimedObjects[i];
Bid.PoolerTrace("<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> %d#, Connection %d#, Reclaiming.\n", ObjectID, obj.ObjectID);
#if !MOBILE
PerformanceCounters.NumberOfReclaimedConnections.Increment();
#endif
emancipatedObjectFound = true;

View File

@@ -145,7 +145,9 @@ namespace System.Data.ProviderBase {
DbConnectionFactory connectionFactory = pool.ConnectionFactory;
#if !MOBILE
connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement();
#endif
connectionFactory.QueuePoolForRelease(pool, true);
}
}
@@ -198,7 +200,9 @@ namespace System.Data.ProviderBase {
newPool.Startup(); // must start pool before usage
bool addResult = _poolCollection.TryAdd(currentIdentity, newPool);
Debug.Assert(addResult, "No other pool with current identity should exist at this point");
#if !MOBILE
connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment();
#endif
pool = newPool;
newPool = null;
}
@@ -275,7 +279,9 @@ namespace System.Data.ProviderBase {
// are completely empty.
DbConnectionFactory connectionFactory = pool.ConnectionFactory;
#if !MOBILE
connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement();
#endif
connectionFactory.QueuePoolForRelease(pool, false);
}
else {

View File

@@ -198,12 +198,14 @@ namespace System.Data.ProviderBase {
}
static private void IntegratedSecurityError(int caller) {
#if !FULL_AOT_RUNTIME
// passing 1,2,3,4,5 instead of true/false so that with a debugger
// we could determine more easily which Win32 method call failed
int lastError = Marshal.GetHRForLastWin32Error();
if ((Win32_CheckTokenMembership != caller) || (E_NotImpersonationToken != lastError)) {
Marshal.ThrowExceptionForHR(lastError); // will only throw if (hresult < 0)
}
#endif
}
}

View File

@@ -32,7 +32,9 @@ namespace System.Data.ProviderBase {
if (null != unknown) {
RuntimeHelpers.PrepareConstrainedRegions();
try {} finally {
#if !FULL_AOT_RUNTIME
base.handle = Marshal.GetIUnknownForObject(unknown); //
#endif
}
}
}

View File

@@ -785,7 +785,11 @@ namespace System.Data.SqlTypes
bRevertAssert = true;
System.Diagnostics.Debug.Assert ( m_fs == null );
#if MOBILE
m_fs = new System.IO.FileStream ( hFile.DangerousGetHandle (), access, ( ( options & System.IO.FileOptions.Asynchronous ) != 0 ), DefaultBufferSize );
#else
m_fs = new System.IO.FileStream ( hFile, access, DefaultBufferSize, ( ( options & System.IO.FileOptions.Asynchronous ) != 0 ) );
#endif
}
finally
{

View File

@@ -39,6 +39,9 @@ namespace System.Data.Sql {
}
override public DataTable GetDataSources() {
#if MONO
throw new NotImplementedException ();
#else
(new NamedPermissionSet("FullTrust")).Demand(); // SQLBUDT 244304
char[] buffer = null;
StringBuilder strbldr = new StringBuilder();
@@ -84,6 +87,7 @@ namespace System.Data.Sql {
}
return ParseServerEnumString(strbldr.ToString());
#endif
}
private static string _Version = "Version:";

View File

@@ -46,7 +46,7 @@ namespace System.Data
return instanceName;
}
#if !MONO
internal static void ReleaseDLLHandles()
{
s_userInstanceDLLHandle = IntPtr.Zero;
@@ -304,6 +304,7 @@ namespace System.Data
if (s_configurableInstances == null)
{
Dictionary<string, InstanceInfo> tempConfigurableInstances = new Dictionary<string, InstanceInfo>(StringComparer.OrdinalIgnoreCase);
#if !NO_CONFIGURATION
object section = PrivilegedConfigurationManager.GetSection("system.data.localdb");
if (section != null) // if no section just skip creation
{
@@ -318,6 +319,7 @@ namespace System.Data
}
}
else
#endif
Bid.Trace( "<sc.LocalDBAPI.CreateLocalDBInstance> No system.data.localdb section found in configuration");
s_configurableInstances = tempConfigurableInstances;
}
@@ -351,7 +353,7 @@ namespace System.Data
instanceInfo.created=true; // mark instance as created
} // CreateLocalDbInstance
#endif
}
}

View File

@@ -802,6 +802,7 @@ namespace System.Data.SqlClient
}
}
#if !MOBILE
public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction transaction) {
if (IsContextConnection) {
throw SQL.NotAvailableOnContextConnection();
@@ -809,6 +810,7 @@ namespace System.Data.SqlClient
EnlistDistributedTransactionHelper(transaction);
}
#endif
override public void Open() {
IntPtr hscp;

View File

@@ -180,14 +180,16 @@ namespace System.Data.SqlClient
throw SQL.NotAvailableOnContextConnection();
}
NameValueCollection settings = (NameValueCollection)PrivilegedConfigurationManager.GetSection("system.data.sqlclient");
Stream XMLStream =null;
#if !NO_CONFIGURATION
NameValueCollection settings = (NameValueCollection)PrivilegedConfigurationManager.GetSection("system.data.sqlclient");
if (settings != null){
string [] values = settings.GetValues(_metaDataXml);
if (values != null) {
XMLStream = ADP.GetXmlStreamFromValues(values, _metaDataXml);
}
}
#endif
// if the xml was not obtained from machine.config use the embedded XML resource
if (XMLStream == null){
@@ -306,9 +308,11 @@ namespace System.Data.SqlClient
public static readonly SqlPerformanceCounters SingletonInstance = new SqlPerformanceCounters();
#if !MOBILE
[System.Diagnostics.PerformanceCounterPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, PermissionAccess=PerformanceCounterPermissionAccess.Write, MachineName=".", CategoryName=CategoryName)]
private SqlPerformanceCounters() : base (CategoryName, CategoryHelp) {
}
#endif
}
}

View File

@@ -27,6 +27,7 @@ namespace System.Data.SqlClient {
using System.Runtime.ExceptionServices;
static internal class AsyncHelper {
#if !MONO
internal static Task CreateContinuationTask(Task task, Action onSuccess, SqlInternalConnectionTds connectionToDoom = null, Action<Exception> onFailure = null) {
if (task == null) {
onSuccess();
@@ -145,7 +146,7 @@ namespace System.Data.SqlClient {
}, TaskScheduler.Default
);
}
#endif
internal static void WaitForCompletion(Task task, int timeout, Action onTimeout = null, bool rethrowExceptions=true) {
try {
@@ -187,6 +188,7 @@ namespace System.Data.SqlClient {
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
private InOutOfProcHelper() {
#if !MONO
// Don't need to close this handle...
// SxS: we use this method to check if we are running inside the SQL Server process. This call should be safe in SxS environment.
IntPtr handle = SafeNativeMethods.GetModuleHandle(null);
@@ -201,6 +203,7 @@ namespace System.Data.SqlClient {
_inProc = true;
}
}
#endif
}
internal static bool InProc {
@@ -674,9 +677,11 @@ namespace System.Data.SqlClient {
static internal Exception BulkLoadMappingsNamesOrOrdinalsOnly() {
return ADP.InvalidOperation(Res.GetString(Res.SQL_BulkLoadMappingsNamesOrOrdinalsOnly));
}
#if !MONO
static internal Exception BulkLoadCannotConvertValue(Type sourcetype, MetaType metatype, Exception e) {
return ADP.InvalidOperation(Res.GetString(Res.SQL_BulkLoadCannotConvertValue, sourcetype.Name, metatype.TypeName), e);
}
#endif
static internal Exception BulkLoadNonMatchingColumnMapping() {
return ADP.InvalidOperation(Res.GetString(Res.SQL_BulkLoadNonMatchingColumnMapping));
}
@@ -768,7 +773,7 @@ namespace System.Data.SqlClient {
return ADP.Argument(msg);
}
}
#if !MONO
static internal Exception MultiSubnetFailoverWithMoreThan64IPs() {
string msg = GetSNIErrorMessage((int)SNINativeMethodWrapper.SniSpecialErrors.MultiSubnetFailoverWithMoreThan64IPs);
return ADP.InvalidOperation(msg);
@@ -783,7 +788,7 @@ namespace System.Data.SqlClient {
string msg = GetSNIErrorMessage((int)SNINativeMethodWrapper.SniSpecialErrors.MultiSubnetFailoverWithNonTcpProtocol);
return ADP.Argument(msg);
}
#endif
//
// Read-only routing
//
@@ -928,10 +933,12 @@ namespace System.Data.SqlClient {
static internal Exception NotificationsNotAvailableOnContextConnection() {
return ADP.InvalidOperation(Res.GetString(Res.SQL_NotificationsNotAvailableOnContextConnection));
}
#if !MONO
static internal Exception UnexpectedSmiEvent(Microsoft.SqlServer.Server.SmiEventSink_Default.UnexpectedEventType eventType) {
Debug.Assert(false, "UnexpectedSmiEvent: "+eventType.ToString()); // Assert here, because these exceptions will most likely be eaten by the server.
return ADP.InvalidOperation(Res.GetString(Res.SQL_UnexpectedSmiEvent, (int)eventType));
}
#endif
static internal Exception UserInstanceNotAvailableInProc() {
return ADP.InvalidOperation(Res.GetString(Res.SQL_UserInstanceNotAvailableInProc));
}
@@ -969,7 +976,7 @@ namespace System.Data.SqlClient {
static internal Exception SubclassMustOverride() {
return ADP.InvalidOperation(Res.GetString(Res.SqlMisc_SubclassMustOverride));
}
#if !MONO
/// <summary>
/// gets a message for SNI error (sniError must be valid, non-zero error code)
/// </summary>
@@ -979,7 +986,7 @@ namespace System.Data.SqlClient {
string errorMessageId = String.Format((IFormatProvider)null, "SNI_ERROR_{0}", sniError);
return Res.GetString(errorMessageId);
}
#endif
// BulkLoad
internal const string WriteToServer = "WriteToServer";

View File

@@ -33,6 +33,7 @@ namespace System.Data.SqlClient {
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
static internal void AliasRegistryLookup(ref string host, ref string protocol) {
#if !MOBILE
if (!ADP.IsEmpty(host)) {
const String folder = "SOFTWARE\\Microsoft\\MSSQLServer\\Client\\ConnectTo";
// Put a try...catch... around this so we don't abort ANY connection if we can't read the registry.
@@ -87,6 +88,7 @@ namespace System.Data.SqlClient {
}
}
}
#endif
}
// Encrypt password to be sent to SQL Server

View File

@@ -1 +1 @@
476e3b77c5972435c2fae38b8352713b606e52f9
f23239bdfdf250cbe95d8abf2d0315beb8455873