Skip to content

Commit 11ca412

Browse files
committed
- Fixed a test that incorrectly consumes an exception when it shouldn't.
- Added diagnostics to Enclave tests that are failing to help diagnose the issues.
1 parent 31de5ba commit 11ca412

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/VirtualSecureModeEnclaveProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public AttestationInfo(byte[] attestationInfo)
153153
EnclaveDHInfo = new EnclaveDiffieHellmanInfo(attestationInfo, offset);
154154
offset += Convert.ToInt32(EnclaveDHInfo.Size);
155155

156-
Debug.Assert(offset == attestationInfo.Length);
156+
Debug.Assert(offset == attestationInfo.Length, $"{offset} == {attestationInfo.Length}");
157157
}
158158
}
159159

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ public void TestExecuteNonQuery(string connection, bool isAsync)
559559
tryagain = true;
560560
break;
561561
}
562+
else
563+
{
564+
throw;
565+
}
562566
}
563567
Assert.Equal(numberOfRows, rowsAffected);
564568
tryagain = false;
@@ -3150,10 +3154,22 @@ private void TestCancellationToken(FieldInfo failpoint, SqlCommand sqlCommand, i
31503154
}
31513155
catch (AggregateException aggregateException)
31523156
{
3157+
bool unexpected = false;
31533158
foreach (Exception ex in aggregateException.InnerExceptions)
31543159
{
3155-
Assert.True(ex is SqlException, @"cancelling a command through cancellation token resulted in unexpected exception.");
3156-
Assert.True(@"Operation cancelled by user." == ex.Message, @"cancelling a command through cancellation token resulted in unexpected error message.");
3160+
if (ex is not SqlException)
3161+
{
3162+
unexpected = true;
3163+
Console.WriteLine($"Cancellation produced non-SqlException: {ex}");
3164+
}
3165+
else
3166+
{
3167+
Assert.True(@"Operation cancelled by user." == ex.Message, @"cancelling a command through cancellation token resulted in unexpected error message.");
3168+
}
3169+
}
3170+
if (unexpected)
3171+
{
3172+
Assert.Fail("Unexpected exceptions encountered; see console for details.");
31573173
}
31583174
}
31593175

0 commit comments

Comments
 (0)