diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs index 056b0fcebf..5ddd978093 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -17,8 +17,6 @@ using System.Transactions; using Microsoft.Data.Common; -[assembly: InternalsVisibleTo("FunctionalTests")] - namespace Microsoft.Data.SqlClient { internal static class AsyncHelper diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs index 0cc0276d6f..efdbe12778 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlUtil.cs @@ -17,8 +17,6 @@ using System.Threading.Tasks; using SysTx = System.Transactions; -[assembly: InternalsVisibleTo("FunctionalTests")] - namespace Microsoft.Data.SqlClient { using Microsoft.Data.Common; diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index e93c6c867f..8e4650fa4f 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -42,7 +42,6 @@ - @@ -54,6 +53,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs index 30152bd2c3..087e5b5c57 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Reflection; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -13,8 +14,14 @@ public class SqlHelperTest { private void TimeOutATask() { + var sqlClientAssembly = Assembly.GetAssembly(typeof(SqlCommand)); + //We're using reflection to avoid exposing the internals + MethodInfo waitForCompletion = sqlClientAssembly.GetType("Microsoft.Data.SqlClient.AsyncHelper") + ?.GetMethod("WaitForCompletion", BindingFlags.Static | BindingFlags.NonPublic); + + Assert.False(waitForCompletion == null, "Running a test on SqlUtil.WaitForCompletion but could not find this method"); TaskCompletionSource tcs = new TaskCompletionSource(); - AsyncHelper.WaitForCompletion(tcs.Task, 1); //Will time out as task uncompleted + waitForCompletion.Invoke(null, new object[] { tcs.Task, 1, null, true }); //Will time out as task uncompleted tcs.SetException(new TimeoutException("Dummy timeout exception")); //Our task now completes with an error }