Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ce38e64
Add release notes for 7.0 (#4053)
mdaigle Mar 17, 2026
86492a1
Validate milestone assignment on pull requests. (#4055)
mdaigle Mar 18, 2026
07a9280
Merge | Pack Mds Target, Wire PR/CI Pipelines to Build2.proj (#4033)
benrr101 Mar 19, 2026
e65124a
Scope NuGet package signing to specific packages (#4058)
samsharma2700 Mar 20, 2026
40db478
Migrate to slnx solution file format (#4070)
paulmedynski Mar 20, 2026
60d4b92
Add missing package reference to System.Data.Common (#4063)
cheenamalhotra Mar 23, 2026
f0e6f6c
Eng | Disable ESRP steps on non-official pipelines (#4077)
cheenamalhotra Mar 25, 2026
59afd23
Test | Fix Transient Fault handling and other flaky unit tests (#4080)
cheenamalhotra Mar 25, 2026
ab95f6f
remove duplicate dictionary lookups (#4000)
SimonCropp Mar 25, 2026
aea5ade
Added CI test stages for SQL Server 16 and 17. (#4087)
paulmedynski Mar 25, 2026
39ae09b
Test | Fix Diagnostic Tests and remove Remote Executor (#4078)
cheenamalhotra Mar 26, 2026
49db91a
Add type forwards to public Abstractions types (#4067)
cheenamalhotra Mar 26, 2026
ccdd846
Create stress test pipeline (#3867)
paulmedynski Mar 27, 2026
8c88784
Fix API docs (#4084)
apoorvdeshmukh Mar 27, 2026
14bbf42
Merge SqlType resource methodology, removed unused strings (#3733)
edwardneal Mar 27, 2026
938d245
Changed SBOM package version to use build number (#4095)
paulmedynski Mar 30, 2026
2c37eb9
Merge | Official Builds From Common Project (#4068)
benrr101 Mar 31, 2026
75b33ad
Trim docs using pwsh via dotnet tool to support cross-platform local …
mdaigle Apr 1, 2026
a11341f
Address flaky DEBUG assertions (#4085)
paulmedynski Apr 1, 2026
4e1d0d4
Revert "Trim docs using pwsh via dotnet tool to support cross-platfor…
mdaigle Apr 1, 2026
9046321
Test | Connection pool transaction tests (#3805)
mdaigle Apr 2, 2026
e500f3a
Address flaky DEBUG assertions (#4085)
paulmedynski Apr 1, 2026
a6e8382
Backport PR 4085 to release/7.0: Address flaky DEBUG assertions
Copilot Apr 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ private static Task<string> AcquireTokenAsync(string authorityURL, string userID
SecureString securePassword = new SecureString();

securePassword.MakeReadOnly();
#pragma warning disable CS0618 // Type or member is obsolete
#pragma warning disable CS0618 // Type or member is obsolete
result = app.AcquireTokenByUsernamePassword(scopes, userID, password).ExecuteAsync().Result;
#pragma warning restore CS0618 // Type or member is obsolete
#pragma warning restore CS0618 // Type or member is obsolete

return result.AccessToken;
});
Expand Down Expand Up @@ -389,7 +389,7 @@ public static string GetSqlServerProperty(SqlConnection connection, ServerProper
}
}

#nullable disable
#nullable restore

private static bool GetSQLServerStatusOnTDS8(string connectionString)
{
Expand Down Expand Up @@ -951,62 +951,89 @@ public static void AssertEqualsWithDescription(object expectedValue, object actu
}
}

public static TException AssertThrowsWrapper<TException>(Action actionThatFails, string exceptionMessage = null, bool innerExceptionMustBeNull = false, Func<TException, bool> customExceptionVerifier = null) where TException : Exception
#nullable enable

/// <summary>
/// Asserts that <paramref name="actionThatFails"/> throws an exception of type
/// <typeparamref name="TException"/> and optionally verifies that its message contains
/// <paramref name="exceptionMessage"/>.
/// </summary>
public static TException AssertThrows<TException>(
Action actionThatFails,
string? exceptionMessage = null)
where TException : Exception
{
TException ex = Assert.Throws<TException>(actionThatFails);

if (exceptionMessage != null)
{
Assert.True(ex.Message.Contains(exceptionMessage),
string.Format("FAILED: Exception did not contain expected message.\nExpected: {0}\nActual: {1}", exceptionMessage, ex.Message));
}

if (innerExceptionMustBeNull)
{
Assert.True(ex.InnerException == null, "FAILED: Expected InnerException to be null.");
}

if (customExceptionVerifier != null)
{
Assert.True(customExceptionVerifier(ex), "FAILED: Custom exception verifier returned false for this exception.");
}

return ex;
}

public static TException AssertThrowsWrapper<TException, TInnerException>(Action actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, bool innerExceptionMustBeNull = false, Func<TException, bool> customExceptionVerifier = null) where TException : Exception
/// <summary>
/// Asserts that <paramref name="actionThatFails"/> throws <typeparamref name="TException"/>
/// whose <see cref="Exception.InnerException"/> is of type <typeparamref name="TInnerException"/>.
/// Optionally verifies message text on both the outer and inner exceptions.
/// </summary>
public static TException AssertThrowsInner<TException, TInnerException>(
Action actionThatFails,
string? exceptionMessage = null,
string? innerExceptionMessage = null)
where TException : Exception
where TInnerException : Exception
{
TException ex = AssertThrowsWrapper<TException>(actionThatFails, exceptionMessage, innerExceptionMustBeNull, customExceptionVerifier);
TException ex = AssertThrows<TException>(actionThatFails, exceptionMessage);

Assert.NotNull(ex.InnerException);
Assert.IsAssignableFrom<TInnerException>(ex.InnerException);

if (innerExceptionMessage != null)
{
Assert.True(ex.InnerException != null, "FAILED: Cannot check innerExceptionMessage because InnerException is null.");
Assert.True(ex.InnerException.Message.Contains(innerExceptionMessage),
string.Format("FAILED: Inner Exception did not contain expected message.\nExpected: {0}\nActual: {1}", innerExceptionMessage, ex.InnerException.Message));
}

return ex;
}

public static TException AssertThrowsWrapper<TException, TInnerException, TInnerInnerException>(Action actionThatFails, string exceptionMessage = null, string innerExceptionMessage = null, string innerInnerExceptionMessage = null, bool innerInnerInnerExceptionMustBeNull = false) where TException : Exception where TInnerException : Exception where TInnerInnerException : Exception
/// <summary>
/// Asserts that <paramref name="actionThatFails"/> throws <typeparamref name="TException"/>
/// whose <see cref="Exception.InnerException"/> is either <typeparamref name="TInnerException"/>
/// or <typeparamref name="TAlternateInnerException"/>. Use this when a race condition
/// (e.g. disposal during an async read) may cause the inner exception type to vary
/// between runs. The <paramref name="innerExceptionMessage"/> is only verified when the
/// inner exception is <typeparamref name="TInnerException"/>.
/// </summary>
public static TException AssertThrowsInnerWithAlternate<TException, TInnerException, TAlternateInnerException>(
Action actionThatFails,
string? exceptionMessage = null,
string? innerExceptionMessage = null)
where TException : Exception
where TInnerException : Exception
where TAlternateInnerException : Exception
{
TException ex = AssertThrowsWrapper<TException, TInnerException>(actionThatFails, exceptionMessage, innerExceptionMessage);
if (innerInnerInnerExceptionMustBeNull)
{
Assert.True(ex.InnerException != null, "FAILED: Cannot check innerInnerInnerExceptionMustBeNull since InnerException is null");
Assert.True(ex.InnerException.InnerException == null, "FAILED: Expected InnerInnerException to be null.");
}
TException ex = AssertThrows<TException>(actionThatFails, exceptionMessage);

if (innerInnerExceptionMessage != null)
Assert.NotNull(ex.InnerException);
Assert.True(
ex.InnerException is TInnerException or TAlternateInnerException,
$"Expected {typeof(TInnerException).Name} or {typeof(TAlternateInnerException).Name}, got: {ex.InnerException?.GetType()}");

if (innerExceptionMessage != null && ex.InnerException is TInnerException)
{
Assert.True(ex.InnerException != null, "FAILED: Cannot check innerInnerExceptionMessage since InnerException is null");
Assert.True(ex.InnerException.InnerException != null, "FAILED: Cannot check innerInnerExceptionMessage since InnerInnerException is null");
Assert.True(ex.InnerException.InnerException.Message.Contains(innerInnerExceptionMessage),
string.Format("FAILED: Inner Exception did not contain expected message.\nExpected: {0}\nActual: {1}", innerInnerExceptionMessage, ex.InnerException.InnerException.Message));
Assert.True(ex.InnerException.Message.Contains(innerExceptionMessage),
string.Format("FAILED: Inner Exception did not contain expected message.\nExpected: {0}\nActual: {1}", innerExceptionMessage, ex.InnerException.Message));
}

return ex;
}

#nullable restore

public static TException ExpectFailure<TException>(Action actionThatFails, string[] exceptionMessages, bool innerExceptionMustBeNull = false, Func<TException, bool> customExceptionVerifier = null) where TException : Exception
{
try
Expand Down Expand Up @@ -1320,7 +1347,7 @@ public static string GetMachineFQDN(string hostname)
}
return fqdn.ToString();
}
}

#nullable disable
#nullable restore
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1318,13 +1318,13 @@ public void TestDeriveParameters()
using (SqlCommand cmd = new SqlCommand(procName, connection))
{
string errorMessage = string.Format(SystemDataResourceManager.Instance.ADP_DeriveParametersNotSupported, "SqlCommand", cmd.CommandType);
DataTestUtility.AssertThrowsWrapper<InvalidOperationException>(
DataTestUtility.AssertThrows<InvalidOperationException>(
() => SqlCommandBuilder.DeriveParameters(cmd),
errorMessage);

errorMessage = string.Format(SystemDataResourceManager.Instance.ADP_OpenConnectionRequired, "DeriveParameters", "");
cmd.CommandType = CommandType.StoredProcedure;
DataTestUtility.AssertThrowsWrapper<InvalidOperationException>(
DataTestUtility.AssertThrows<InvalidOperationException>(
() => SqlCommandBuilder.DeriveParameters(cmd),
errorMessage);

Expand All @@ -1335,7 +1335,7 @@ public void TestDeriveParameters()

cmd.CommandText = "Test_EmployeeSalesBy";
errorMessage = string.Format(SystemDataResourceManager.Instance.ADP_NoStoredProcedureExists, cmd.CommandText);
DataTestUtility.AssertThrowsWrapper<InvalidOperationException>(
DataTestUtility.AssertThrows<InvalidOperationException>(
() => SqlCommandBuilder.DeriveParameters(cmd),
errorMessage);

Expand Down
Loading
Loading